Setting up an AutoHeader

An autoheader attempts to determine the Content-Type. Some additional automatic headers are available in the palette.
Prerequisites: The httpClient palette is open.
The driver populates our test service (which echoes back the request content) from our Data slot, and automatically populates the Content-Length and Content-Type:
Image

Perform the following steps:
  1. Notice that the Content-Length and Content-Type headers are automatically populated.
    In another example, Content-Type defaults to text/plain. An AutoHeader component makes this possible. In this case, the Content-Type auto header is underneath the Request Body.
    Image

    This component attempts to determine the Content-Type. For example, if the Data slot is changed to: { “message”: ”this is JSON” }, the auto header calculates the new Content-Type as ‘application/json’.

    Image
  2. To override this behaviour, enter your own value into User Content Type slot
    Image
  3. Locate the additional AutoHeaders in the palette.
    Image
  4. To apply each AutoHeader, drag the required component from the palette into the Headers folder:
    Image