Nav

To Route Requests Based on HTTP Method

  1. Create a flow with an HTTP Listener, set its Path to requests and the Allowed Methods field to GET.

  2. Create a Global Element for the Listener, set Host to localhost, leave the Port as the default 8081 and set the Base Path to mypath.

  3. Add another building block, such as a Logger transformer, after the HTTP Listener. Set Message to flow 1.

  4. Create a second flow with an HTTP Listener. In Extension configuration, select the existing HTTP_Listener_Config global element you created for the first connector.

  5. Set its Path to requests. Set the Allowed Methods field to POST.

  6. Add a Logger transformer after the HTTP Listener. Set Message to flow 2.

  7. Using a browser extension such as Postman, send HTTP GET and POST requests to http://localhost:8081/mypath/requests.

    The GET request response is flow 1. The POST request response is flow2.

  8. Send a DELETE request.

    "405 Method Not Allowed" is returned.