Skip to content

Instantly share code, notes, and snippets.

@Hopefuls
Last active March 5, 2021 02:02
Show Gist options
  • Save Hopefuls/9fc6d88c4657481a13fba4cda67b9338 to your computer and use it in GitHub Desktop.
Save Hopefuls/9fc6d88c4657481a13fba4cda67b9338 to your computer and use it in GitHub Desktop.
Template for my GitHub webhook
public class GitHubContext implements HttpHandler {
@Override
public void handle(HttpExchange exchange) throws IOException {
RequestManager requestManager = new RequestManager(exchange);
ResponseManager responseManager = new ResponseManager(exchange);
System.out.println("Received!! hello!");
JSONObject object = requestManager.asJson();
responseManager.writeResponse("thanks lol");
responseManager.setResponseCode(200);
HandleLog.handleLogging(object, requestManager.getHeaders().getFirst("X-GitHub-Event"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment