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

    https://github.com/apache/nifi/pull/272#discussion_r56928549
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
 ---
    @@ -444,14 +455,27 @@ public void onPropertyModified(final 
PropertyDescriptor descriptor, final String
     
         @Override
         protected Collection<ValidationResult> customValidate(final 
ValidationContext validationContext) {
    -        final List<ValidationResult> results = new ArrayList<>(1);
    +        final List<ValidationResult> results = new 
ArrayList<ValidationResult>(3);
    +
    +        // proxy host and port validation
             final boolean proxyHostSet = 
validationContext.getProperty(PROP_PROXY_HOST).isSet();
             final boolean proxyPortSet = 
validationContext.getProperty(PROP_PROXY_PORT).isSet();
    -
             if ((proxyHostSet && !proxyPortSet) || (!proxyHostSet && 
proxyPortSet)) {
                 results.add(new ValidationResult.Builder().subject("Proxy Host 
and Port").valid(false).explanation("If Proxy Host or Proxy Port is set, both 
must be set").build());
             }
     
    +        // body and content-type validation
    +        final boolean contentTypeSet = 
validationContext.getProperty(PROP_CONTENT_TYPE).isSet();
    +        final boolean sendBody = 
validationContext.getProperty(PROP_SEND_BODY).asBoolean();
    +        final String contentType = 
validationContext.getProperty(PROP_CONTENT_TYPE).getValue();
    +        if(contentTypeSet && contentType.isEmpty() && sendBody) {
    +            results.add(new 
ValidationResult.Builder().subject("Content-Type and Send body")
    +                    .valid(false).explanation("If Content-Type is set to 
empty, Send body property must be set to false").build());
    +        }
    +        if(!sendBody && !contentType.isEmpty()) {
    +            results.add(new 
ValidationResult.Builder().subject("Content-Type and Send 
body").valid(false).explanation("If body is not sent, Content-Type must be set 
to empty").build());
    +        }
    +
             return results;
    --- End diff --
    
    This custom validation rule can be removed if the content-type property is 
left alone.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to