Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

About Receiving HTTP Requests

The HTTP connector has a Listener operation that receives requests over HTTP or HTTPS protocol. Receiving a request, and other incidents, initiate a Mule event. The event passes the request body to the next element of the flow as the message payload. In addition to the payload, the Mule message includes attributes. You can refer to attributes, such as headers, query parameters, and so on using HttpRequestAttributes syntax.

HTTP Request Mapping

The following diagram explains how to access information about the request.

Map of HTTP Response to Mule Event

You use DataWeave syntax to access this information.

HTTP Responses

The response to a request can include the following information:

  • Status code

  • Reason phrase

  • Body

  • Headers

You can configure a response for a successful or failed execution of the flow of the listener. By default, the former presents the payload as a body and yields a 200 status code. By default, the latter presents the error description as a body and yields a 500 status code.

Securing Requests and Responses

The HTTP method most often configured for an HTTP or HTTPS Listener operation is GET. The HTTP Listener default allows all the HTTP Methods. Follow the best practice to limit the allowed HTTP methods to only the method or methods for your app.

Configure Allowed Methods in Advanced:

allowed methods

You can use Transport Layer Security (TLS) and configure HTTPS by providing a key store with your certificate. You can also enable 2-way authentication by providing a trust store.