Back to Home
$httpRemoveHeader
$httpRemoveHeader removes a header that was previously added with $httpAddHeader. Use this when you need to clear a header before your next request.
Syntax
$httpRemoveHeader[Header name]
Header name: the name of the header to remove.
What happens
$httpRemoveHeaderremoves the header from memory.- The next HTTP function you call will not include that header.
Example 1: Removing a header before the next request
$httpAddHeader[Authorization;Bearer abc123def]
$httpGet[https://api.example.com/protected]
$httpResult
$httpRemoveHeader[Authorization]
$httpGet[https://api.example.com/public]
$httpResult
What happens:
- The first request sends the
Authorizationheader and gets protected data. $httpRemoveHeaderclears theAuthorizationheader.- The second request does not include the header. The public endpoint works fine without it.
Example 2: Resetting headers between requests
$httpAddHeader[content-type;application/json]
$httpPost[https://api.example.com/data;{"key":"value"}]
$httpResult
$httpRemoveHeader[content-type]
$httpPost[https://api.example.com/login]
$httpResult
What happens:
- The first request sends JSON with the correct content type.
$httpRemoveHeaderclears it before the next request.- The second request sends no content type header.
Common uses
- Clearing authentication headers after accessing a protected endpoint
- Resetting headers between requests to avoid sending stale data
- Removing headers that are no longer needed
See also
- $httpAddHeader: to add a header to your request
- $httpGetHeader: to read a header from the response
- $httpResult: to read the data from the response