-
Notifications
You must be signed in to change notification settings - Fork 16
Handle null response body and support Parameters #7
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
Conversation
- add support for request parameters - add to git ignore for intellj files and target directory
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.
Thanks for the PR! Few minor comments
@@ -76,7 +77,9 @@ private GenericApiGatewayResponse execute(HttpMethodName method, String resource | |||
request.setEndpoint(this.endpoint); | |||
request.setResourcePath(resourcePath); | |||
request.setHeaders(buildRequestHeaders(headers, apiKey)); | |||
|
|||
if (parameters != null) { |
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.
Is this null check necessary?
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.
Your unit tests fail without it.
private final HttpMethodName httpMethod; | ||
private final String resourcePath; | ||
private final InputStream body; | ||
private final Map<String, String> headers; | ||
private final Map<String, List<String>> parameters; |
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.
Should this be called queryStringParameters?
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.
parameters seemed to be in the same flavor of 'headers', 'body' etc. Also it is setParameters() in the DefaultRequest
return this; | ||
} | ||
|
||
public boolean hasBody() { |
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.
Please remove this if it is not used
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 do use it ;), but I can remove
@@ -32,9 +34,18 @@ public GenericApiGatewayRequestBuilder withHeaders(Map<String, String> headers) | |||
return this; | |||
} | |||
|
|||
public GenericApiGatewayRequestBuilder withParameters(Map<String,List<String>> parameters) { |
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.
Should this be withQueryStringParameters?
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.
see above
if (httpResponse.getContent()!= null) { | ||
this.body = IOUtils.toString(httpResponse.getContent()); | ||
} else { | ||
this.body = null; |
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.
Is this else block required? Isn't body null by default?
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.
because it is final, there are "Error:(17, 5) java: variable body might not have been initialized" without it
Merged, thanks again. Can you elaborate on how you plan to use this in Apache Nifi? |
I'm using the classes ( with reference to you in the NOTICE as the apache lic. requires ) to add a gateway api processor that lets you invoke http methods on it from nifi. |
Ryan, first thank you for your great library.
I have created a derivative work to add support for aws gateway api to the apache nifi project,
NIFI PR#2588
here are a couple of changes that I've made.
This change is