[ 
https://issues.apache.org/jira/browse/NIFI-3280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15983196#comment-15983196
 ] 

ASF GitHub Bot commented on NIFI-3280:
--------------------------------------

Github user nickcarenza commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1395#discussion_r113246581
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PostHTTP.java
 ---
    @@ -880,6 +936,29 @@ public long getContentLength() {
             }
         }
     
    +    private FlowFile appendResponseData(final ProcessContext context, 
final ProcessSession session, final FlowFile original, String responseBody, int 
statusCode, String mimeType) {
    +        FlowFile appended = original;
    +        switch (context.getProperty(RESPONSE_BODY_DESTINATION).getValue()) 
{
    +            case DESTINATION_ATTRIBUTE:
    +                if (context.getProperty(RESPONSE_BODY_ATTRIBUTE).isSet()) {
    +                    appended = session.putAttribute(appended, 
context.getProperty(RESPONSE_BODY_ATTRIBUTE).getValue(), responseBody);
    +                } else {
    +                    getLogger().warn("{} is set to {} but {} is not set", 
new 
Object[]{RESPONSE_BODY_DESTINATION.getName(),DESTINATION_ATTRIBUTE,RESPONSE_BODY_ATTRIBUTE.getName()});
    --- End diff --
    
    I agree it should be detected in validation. I didn't realize properties 
could be validated within the context of other properties.


> PostHTTP Option to write response to attribute or flowfile content
> ------------------------------------------------------------------
>
>                 Key: NIFI-3280
>                 URL: https://issues.apache.org/jira/browse/NIFI-3280
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework
>            Reporter: Nicholas Carenza
>            Priority: Minor
>
> Currently there doesn't seem to be a way to access anything about the 
> response of an HTTP request from the PostHTTP processor other than whether it 
> failed or succeeded.
> I would like to be able to:
>  - store the response body in an attribute or replace the flowfile content
>  - store the status code in an attribute



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to