RestEntitiesWebHandler HandlePost doesn't check type of Entity property
 
Forums / SmartComponent Library - Developer Forum / RestEntitiesWebHandler HandlePost doesn't check type of Entity property

RestEntitiesWebHandler HandlePost doesn't check type of Entity property

4 posts, 0 answered
  1. Bert Strobbe
    Bert Strobbe avatar
    19 posts
    Registered:
    25 Oct 2018
    22 May 2019
    Link to this post
    I recently had a case where no body was sent with a POST REST call (Jira Webhook with the send empty body checked (we changed this afterwards)).
    The HandlePost method in the RestEntitiesWebHandler then fails, because it just casts the Entity property to JsonObject, but in that case it's an empty OpenEdge.Core.Memptr. 

    We think this method should validate en check the type of the Entity property as according to https://documentation.progress.com/output/oehttpclient/oe117/ this property can be of any type.

  2. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    22 May 2019 in reply to Bert Strobbe
    Link to this post
    We certainly implement a different error message.

    But it would still fail when there's no payload - because there's simply nothing to do. 

    I would suggest you log a ticket with your desired wording in the new error message.
  3. Bert Strobbe
    Bert Strobbe avatar
    19 posts
    Registered:
    25 Oct 2018
    22 May 2019 in reply to Mike Fechner
    Link to this post
    Why would it need to fail without payload and isn't there nothing to do in that case?
    If the request:Entity property is empty, it just shouldn't try to cast. 
    The URI can contain enough information to create the method parameters for the method.  
    My use case was entering a worklog in Jira. That would trigger a webhook with a call to a business task. The issue id is provided in the URL and I don't really need the body/json because that doesn't contain all the info I need anyway (no custom worklog fields). In my business task I would call back to Jira to get the needed information. 
       
     
  4. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    22 May 2019 in reply to Bert Strobbe
    Link to this post
    In the initial call you didn't mention the use of an invokable method. For a POST to create or update a record, there's certainly nothing to do without a payload. 

    For an invokable method, that might be indeed different. Please go on and create an enhancement request.  
4 posts, 0 answered