🎉 Requestly joins BrowserStack to build the future of application testing. Read more

HTTP Headers

TE

HTTP Header

The HTTP TE request header specifies which transfer encodings the user agent is willing to accept. These transfer encodings are used for message compression and data chunking during transmission.

Transfer encodings are applied at the protocol level, so applications receiving responses will access the message body as if no encoding has been applied.

Header typeRequest header
Forbidden request headerYes

Syntax

Here are some common transfer encodings you might encounter:

TE: compress
TE: deflate
TE: gzip
TE: trailers

Multiple directives can be combined in a comma-separated list with optional quality values as weights:

TE: trailers, deflate;q=0.5

Directives

The following are common HTTP transfer encodings used for data compression and chunking in HTTP communication:

compress
This format uses the Lempel-Ziv-Welch (LZW) algorithm for data compression, accepted as a transfer coding method to efficiently compress data transmitted over HTTP.
deflate
The zlib structure is employed within this transfer encoding to compress data, enabling efficient data transfer.
gzip
This encoding uses the Lempel-Ziv coding (LZ77) algorithm combined with a 32-bit CRC (Cyclic Redundancy Check) for data integrity, serving as a widely supported transfer coding method.
trailers
Indicates that the client agrees to process trailer fields in a chunked transfer encoding, allowing additional metadata to be sent after the message body.
q
The q parameter specifies quality values for transfer codings, enabling clients and servers to prioritize encoding methods when multiple options are acceptable.

Example

Using the TE header with quality values

In the following request, the client indicates a preference for gzip-encoded responses with deflate as a second choice, using a q value:

GET /resource HTTP/1.1
Host: example.com
TE: gzip; q=1.0, deflate; q=0.8

How to Modify Header using Requestly

Requestly is a handy Chrome extension that lets you change HTTP headers, including the TE header. This can be important when you want to test how your application handles different transfer encodings or debugging streaming responses. Steps to Modify the TE Header:

  1. Install and open the Requestly Chrome extension. You can get it from the Chrome Web Store.
  2. Create a new rule: Click on “Create Rule” and select “Modify Headers” from the options.
  3. Add a new header modification:
    • Under “Action”, choose either “Add” or “Override”.
    • In the “Header Name” input, type TE.
    • In the “Header Value” field, enter the desired transfer encoding(s) (e.g., trailers).
  4. Set the URL condition: Enter the URL or pattern where this header should be applied (e.g., https://your-api.com/*).
  5. Save the rule.

After completion, Requestly will add or replace the TE header in all matching requests, enabling you to check how your server handles different transfer encodings. Modifying the TE header is useful when you want to test if your server supports trailers or other transfer encodings, which can affect how responses are streamed and processed. This helps ensure proper communication between client and server for streaming data.