You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/04/25 14:27:04 UTC

[jira] [Commented] (NIFI-3280) PostHTTP Option to write response to attribute or flowfile content

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

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

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

    https://github.com/apache/nifi/pull/1395#discussion_r113209753
  
    --- 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 --
    
    This should not be a warn. It should be an ERROR.
    
    I think it would be a good idea to add a custom validator to identify this very same issue during configuration, instead of ignoring it during execution.
    
    What do you think?


> 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)