Layer7 API Management

  • 1.  Is it possible to override the HTTP Method before calling a Route via HTTP(s) assertion?

    Posted Oct 05, 2018 11:10 AM

    In some cases, clients are only able to send GET or POST requests to an API that might require other methods such as PUT or DELETE. A common way to work around that is to use the X-HTTP-Method-Override header in order to state that you really want to use method PUT for example even though you used a POST.

     

    From what I can see it's not possible to set the Method property of a Route via HTTP(S) assertion to other than either <automatic> or one of the values listed in the drop-down.

     

    Apart from having to use multiple Route assertions each with its own method in order to use the appropriate one based on the X-HTTP-Method-Override value, is there a way to set a context variable to override request.http.method which is read-only?



  • 2.  Re: Is it possible to override the HTTP Method before calling a Route via HTTP(s) assertion?
    Best Answer

    Broadcom Employee
    Posted Oct 05, 2018 11:28 AM

    Hi Yanick,

     

    The request method can be variablized in the route assertion. You could setup a few at least one branches to handle the case, i.e: if POST then set method to PUT. Would that handle your use case? Perhaps I misunderstood.

     

    A note the variable does need to be defined first or it will throw an error trying to save the route assertion.

     

     

    Regards,

    Joe



  • 3.  Re: Is it possible to override the HTTP Method before calling a Route via HTTP(s) assertion?

    Posted Oct 05, 2018 11:31 AM

    Oh! I tried that but it gave an error because the context variable didn't exist so I thought it didn't support this. If it's that simple then thank you!