Skip to content

Instantly share code, notes, and snippets.

@theawesomenayak
Created October 18, 2020 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theawesomenayak/29b3a5283293880b6910a10854a94cd1 to your computer and use it in GitHub Desktop.
Save theawesomenayak/29b3a5283293880b6910a10854a94cd1 to your computer and use it in GitHub Desktop.
APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent()
.withHeaders(headers);
try {
final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
String output = String
.format("{ \"message\": \"hello world\", \"location\": \"%s\" }", pageContents);
return response.withStatusCode(200).withBody(output);
} catch (IOException e) {
return response.withBody("{}").withStatusCode(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment