exceptionfactory commented on code in PR #9500:
URL: https://github.com/apache/nifi/pull/9500#discussion_r1832705179
##########
nifi-commons/nifi-web-client-api/src/main/java/org/apache/nifi/web/client/api/HttpRequestBodySpec.java:
##########
@@ -31,4 +31,14 @@ public interface HttpRequestBodySpec extends
HttpRequestHeadersSpec {
* @return HTTP Request Headers Specification builder
*/
HttpRequestHeadersSpec body(InputStream inputStream, OptionalLong
contentLength);
+
+ /**
+ * Set Request Body as provided string
+ * This should be used only when the payload is small. For large amount of
data,
+ * @see HttpRequestBodySpec#body(InputStream, OptionalLong)
+ *
+ * @param body String representation of the payload
Review Comment:
```suggestion
* @param body String representation of the payload encoded as UTF-8
```
##########
nifi-commons/nifi-web-client/src/main/java/org/apache/nifi/web/client/StandardHttpResponseEntity.java:
##########
@@ -32,14 +33,18 @@ class StandardHttpResponseEntity implements
HttpResponseEntity {
private final InputStream body;
+ private final URI requestEndpoint;
Review Comment:
```suggestion
private final URI uri;
```
##########
nifi-commons/nifi-web-client-api/src/main/java/org/apache/nifi/web/client/api/HttpResponseEntity.java:
##########
@@ -43,4 +44,11 @@ public interface HttpResponseEntity extends Closeable {
* @return HTTP Response Body stream can be empty
*/
InputStream body();
+
+ /**
+ * Get the HTTP request endpoint that was accessed to generate this HTTP
Review Comment:
```suggestion
* Get the endpoint URI that was accessed to generate this HTTP response
```
##########
nifi-commons/nifi-web-client-api/src/main/java/org/apache/nifi/web/client/api/HttpResponseEntity.java:
##########
@@ -43,4 +44,11 @@ public interface HttpResponseEntity extends Closeable {
* @return HTTP Response Body stream can be empty
*/
InputStream body();
+
+ /**
+ * Get the HTTP request endpoint that was accessed to generate this HTTP
+ *
+ * @return the HTTP request endpoint
Review Comment:
```suggestion
* @return HTTP URI from which the response was retrieved
```
##########
nifi-commons/nifi-web-client-api/src/main/java/org/apache/nifi/web/client/api/HttpRequestBodySpec.java:
##########
@@ -31,4 +31,14 @@ public interface HttpRequestBodySpec extends
HttpRequestHeadersSpec {
* @return HTTP Request Headers Specification builder
*/
HttpRequestHeadersSpec body(InputStream inputStream, OptionalLong
contentLength);
+
+ /**
+ * Set Request Body as provided string
Review Comment:
Recommend indicating that the request body will be encoded as UTF-8.
```suggestion
* Set Request Body as provided string encoded as UTF-8.
```
##########
nifi-commons/nifi-web-client-api/src/main/java/org/apache/nifi/web/client/api/HttpResponseEntity.java:
##########
@@ -43,4 +44,11 @@ public interface HttpResponseEntity extends Closeable {
* @return HTTP Response Body stream can be empty
*/
InputStream body();
+
+ /**
+ * Get the HTTP request endpoint that was accessed to generate this HTTP
+ *
+ * @return the HTTP request endpoint
+ */
+ URI getRequestEndpoint();
Review Comment:
I recommend naming this `requestUri`, or simply or `uri`, similar to the
[HttpResponse](https://docs.oracle.com/en/java/javase/21/docs/api/java.net.http/java/net/http/HttpResponse.html)
model.
```suggestion
URI getUri();
```
##########
nifi-commons/nifi-web-client/src/main/java/org/apache/nifi/web/client/StandardWebClientService.java:
##########
@@ -338,7 +346,7 @@ public HttpResponseEntity retrieve() {
final InputStream responseBody = response.body();
final InputStream body = responseBody == null ? new
ByteArrayInputStream(EMPTY_BYTES) : responseBody;
- return new StandardHttpResponseEntity(code, headers, body);
+ return new StandardHttpResponseEntity(code, headers, body,
request.uri());
Review Comment:
It seems like the `response.uri()` method should used here instead.
```suggestion
return new StandardHttpResponseEntity(code, headers, body,
response.uri());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]