-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amazon Lambda - minor cleanup #2197
Conversation
68bb1f4
to
52b2cfb
Compare
...azon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaTemplate.java
Outdated
Show resolved
Hide resolved
HttpURLConnection responseConnection = (HttpURLConnection) responseUrl.openConnection(); | ||
responseConnection.setDoOutput(true); | ||
responseConnection.setRequestMethod("POST"); | ||
mapper.writeValue(responseConnection.getOutputStream(), response); | ||
while (responseConnection.getInputStream().read() != -1) { | ||
|
||
// Read data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's happening here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I think it reads the data until the end of the stream is reached. I've just added a comment because an empty while loop looks weird to me ;-).
52b2cfb
to
1a72573
Compare
public void handle(HttpServerExchange exchange, String message) { | ||
ObjectMapper mapper = new ObjectMapper(); | ||
try { | ||
FunctionError result = mapper.readerFor(FunctionError.class).readValue(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should cache the reader here. It can be done in another PR though as it was already preexisting. I don't know if we use this pattern elsewhere in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is safe to share a reader then +1 for a new PR ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I missed it's just in the tests. We don't really care then.
No description provided.