Handle null response body and support Parameters#7
Conversation
- add support for request parameters - add to git ignore for intellj files and target directory
rpgreen
left a comment
There was a problem hiding this comment.
Thanks for the PR! Few minor comments
| request.setResourcePath(resourcePath); | ||
| request.setHeaders(buildRequestHeaders(headers, apiKey)); | ||
|
|
||
| if (parameters != null) { |
There was a problem hiding this comment.
Your unit tests fail without it.
| 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.
Should this be called queryStringParameters?
There was a problem hiding this comment.
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.
Please remove this if it is not used
There was a problem hiding this comment.
I do use it ;), but I can remove
| return this; | ||
| } | ||
|
|
||
| public GenericApiGatewayRequestBuilder withParameters(Map<String,List<String>> parameters) { |
There was a problem hiding this comment.
Should this be withQueryStringParameters?
| if (httpResponse.getContent()!= null) { | ||
| this.body = IOUtils.toString(httpResponse.getContent()); | ||
| } else { | ||
| this.body = null; |
There was a problem hiding this comment.
Is this else block required? Isn't body null by default?
There was a problem hiding this comment.
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