Skip to content

HTTP Request Headers

Overview

The Headers tab in Martini's HTTP Request Editor lets you attach HTTP headers to outgoing requests, passing metadata such as API keys, content negotiation preferences, or custom directives to the target server. It also displays the headers that Martini adds to every request, so you always know exactly what will be sent.

What You Will Learn

  • How to add HTTP headers with a name, value, and optional description
  • How to temporarily exclude a header from a request without deleting it
  • How to permanently remove one or more user-defined headers
  • How to view the auto-generated headers Martini adds to every request
  • How to override an auto-generated header with a user-defined one
  • How to use variables in header names and values

When To Use This

Use this when you need to:

  • Pass an API key or custom token using a non-standard header (for example, X-API-Key)
  • Set Accept or Accept-Language to control the response format or locale
  • Add cache control or tracing headers such as Cache-Control or X-Correlation-ID
  • Supply any request metadata not covered by the Authentication or Body tabs
  • Review all headers Martini sends with a request, including system-managed ones
  • Override an auto-generated header (for example, replace the auto-set Content-Type with a custom value)
  • Inject variable values into header names or values

Prerequisites

Managing HTTP Request Headers

The Headers tab is the central place for defining all user-controlled key-value pairs sent in the HTTP header section of a request. Headers deliver metadata about the request — enabling the target server to authenticate, parse, cache, and respond to it correctly.

Adding User-Defined HTTP Headers

To add a user-defined header to a request:

  1. Open the Headers tab in the HTTP Request Editor.
  2. Click the Add button in the Headers toolbar, or press + .
  3. Fill in the following fields:
    • Name — The header name (for example, X-API-Key or Accept).
    • Value — The value assigned to the header (for example, application/json).
    • Description — An optional note describing the header's purpose; not sent with the request

Expected result: The new header appears as a row in the Headers table and is included in the request when sent.

Excluding and Removing HTTP Headers

You can temporarily exclude or permanently remove headers without disrupting the rest of your request configuration.

To exclude a header temporarily:

  • Uncheck the checkbox next to the header name.

Expected result: The header remains visible in the table but is omitted from the request. Check the box to re-enable it.

To permanently remove one or more headers:

  1. Select the row or rows you want to delete.
  2. Click the Delete button in the Headers toolbar, or press .

Expected result: The selected headers are removed from the table and no longer sent with the request.

Viewing Auto-Generated Headers

Auto-generated headers are HTTP headers that Martini adds to every request based on the request configuration. Some auto-generated headers can be overridden by your user-defined headers; others are fixed and cannot be changed from the Headers tab.

Toggling the Auto-Generated Headers View

To view auto-generated headers alongside your user-defined headers:

  1. Open the Headers tab in the HTTP Request Editor.
  2. Click the Show auto-generated headers button in the Headers toolbar.

Expected result: Auto-generated headers appear in the Headers table, listed alongside your user-defined entries.

To hide auto-generated headers:

  • Click the Hide auto-generated headers button in the Headers toolbar.

Expected result: Auto-generated headers are hidden from view. They are still included in every request sent.

How Auto-Generated Headers Work

Martini generates these headers automatically based on the request configuration — including settings from other tabs, the request URL, and other factors.

For example:

  • The Body tab sets Content-Type based on the selected body type (for example, application/json for a JSON body).
  • The Authentication tab sets the Authorization header based on the selected scheme and configured credentials.

Because these headers are derived from the request configuration, they cannot be edited or deleted directly in the Headers tab. However, some can be overridden by disabling the auto-generated header and adding a user-defined one with the same name.

Overriding Auto-Generated Headers

Each auto-generated header includes a checkbox that controls whether it is included in the request:

  • Active — Can be unchecked to exclude the header.
  • Dimmed — Always included; cannot be unchecked.

To replace a header:

  1. Reveal auto-generated headers.
  2. Uncheck the header to exclude it from the request.
  3. Add a header with the same name and desired value.

Expected result: The auto-generated header is excluded from the request, and your user-defined header is included instead.

Using Variables in Headers

Header names and values both support variable references using the [[variableName]] syntax. When the request is sent, Martini replaces each reference with the variable's current value.

This is useful for injecting reusable data — such as API keys, tokens, or custom prefixes — without hardcoding them directly into the header configuration. To learn how to define variables, see Managing Variables in Martini's HTTP Client.

Variable Reference Syntax

Wrap the variable name in double square brackets:

1
[[variableName]]

Variables can be used as the entire value or embedded within a larger string:

Usage Example Result (if authToken = abc123, region = us)
Entire value [[authToken]] abc123
Embedded in text Bearer [[authToken]] Bearer abc123
In the header name X-[[region]]-API-Key X-us-API-Key

Troubleshooting HTTP Request Header Issues

Problem Detection Cause Fix
Header not sent with request Server response does not reflect expected behavior Header checkbox is unchecked Enable the checkbox next to the header name to include it in the request
Duplicate header causes unexpected behavior API returns inconsistent or unexpected results Same header defined in both the user-defined Headers table and the auto-generated section Either remove the user-defined header or disable the auto-generated header so only one is sent in the request
API returns 400 Bad Request Server responds with 400 status Malformed header name or unsupported header value Verify the header name and value against your API's documentation and correct any typos or formatting errors

Helpful Resources