Sending GET Request with Accept-Encoding Header

To send a GET request with an Accept-Encoding header, you need to provide an Accept-Encoding header in the "Name: value" format, just like you would for any standard HTTP header. The Accept-Encoding HTTP header indicates that the client can accept data in the specified encoding (for example Accept-Encoding: gzip, deflate, br) and does not indicate the expected data MIME type. To set the acceptable MIME type client sends an Accept header (for example, Accept: text/htm). The Accept-Encoding title is used to speed up the data download from the server since the server can compress the data before sending it to the client in one of the supported encodings. In this GET request with the Accept-Encoding Header example, we send a GET request to the ReqBin echo URL. Click Send to execute the GET Request with the Accept-Encoding Header example online and see the results.
Sending GET Request with Accept-Encoding Header Send
GET /echo/get/json HTTP/1.1
Host: reqbin.com
Accept-Encoding: gzip

Updated: Viewed: 23158 times

What is HTTP GET request?

The HTTP GET request method requests a resource from the server using the URL provided. The GET method is one of nine standard methods of HTTP (Hypertext Transfer Protocol). A GET request should only be used to retrieve data from a server. The HTTP GET requests cannot send data to the server on the body of an HTTP GET message and cannot change the server's state. To make changes to the server, use the PUT, POST, PATCH, or DELETE methods.

HTTP GET Request Example
GET /echo HTTP/1.1
Host: reqbin.com
Accept: */*

What is Accept-Encoding?

The Accept-Encoding HTTP Request Header is a request header comparison algorithm. All HTTP clients in use tell the server which encoding it supports. The server will then respond in any of the supported encoding formats. The server uses content negotiation to select one of the offers and informs the client of this choice with a Content-Encoding response header.

Accept-Encoding HTTP Header Syntax

The following is the syntax with the Accept-Encoding HTTP request header structure:

Accept-Encoding HTTP Header Syntax
Accept-Encoding: gzip

Accept-Encoding: compress

Accept-Encoding: deflate

Accept-Encoding: br

Accept-Encoding: identity

Accept-Encoding: *

  • gzip: a compression format based on the Lempel-Ziv coding (LZ77) and a 32-bit CRC.
  • compress: a compression format based on the Lempel-Ziv-Welch (LZW) algorithm.
  • deflate: a compression format based on Zlib, using the deflate compression algorithm.
  • br: a compression format based on the Brotli algorithm.
  • identity: the directive indicates the identity acceptable function
  • *: the directive matches any encoding in the header, whether listed or not. It is the default value.

Accept-Encoding HTTP Header Examples

The Accept-Encoding HTTP request header passes the appropriate compressed data to the web browser. The following is an example of the format for using the Accept-Encoding HTTP request header:

Accept-Encoding HTTP Header Examples
Accept-Encoding: gzip

Accept-Encoding: gzip, deflate, br

Accept-Encoding: br;q=1.0, gzip;q=0.7, *;q=0.1

See also

Generate Code Snippets for GET Request Accept Encoding Header Example

Convert your GET Request Accept Encoding Header request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the ReqBin code generator.