Sending GET Request without Accept-Encoding Header [Node.js Code]

The Accept-Encoding HTTP header indicates that the client can accept data in the specified encoding. The Accept-Encoding header is used to speed up the data download from the server because the server can compress the data before sending it to the client in one of the supported encodings. If you send a GET request without specifying Accept-Encoding header, or if the server does not support the type of compression the client accepts, the response body will not be compressed. In this GET request without the Accept-Encoding Header example, we send a GET request to the ReqBin echo URL. Click Send to execute the GET Request without the Accept-Encoding Header example online and see the results. The Node.js code was automatically generated for the GET Request Without Accept Encoding Header example.
Sending GET Request without Accept-Encoding Header [Node.js Code] Send
GET /echo HTTP/1.1
Host: reqbin.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Language: en-US,en;q=0.9
Accept-Encoding: identity

Updated: Viewed: 8922 times
Node.js code for GET Request Without Accept Encoding Header example

Node.js code for GET Request Without Accept Encoding Header Example

This Node.js code snippet was generated automatically for the GET Request Without Accept Encoding Header example.
<< Back to the GET Request Without Accept Encoding Header example

What is HTTP GET request?

The GET method is one of nine standard HTTP (Hypertext Transfer Protocol) request methods to request data from a server. The HTTP GET request method requests a resource from the server using the URL provided. GET method requests should only receive data. They cannot accept data in the body of a GET message and should not affect data on the server. To make changes to the server, use the PATCH, PUT, POST, 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 headers are an algorithm for comparing request headers. The HTTP client tells the server what encoding it supports. Depending on which encoding format is supported by the server, the server will respond in that format. The server selects content negotiation for one of the offers and informs the client of this choice with a Content-Encoding response header.

Accept-Encoding HTTP Header Syntax

Below is the syntax of the Accept-Encoding HTTP request header:

Accept-Encoding HTTP Header Syntax
Accept-Encoding: gzip

Accept-Encoding: compress

Accept-Encoding: deflate

Accept-Encoding: br

Accept-Encoding: identity

Accept-Encoding: *

  • gzip: the Lempel-Ziv coding (LZ77) and 32-bit CRCs are used to compress data;
  • Compress: the Lempel-Ziv-Welch (LZW) algorithm is used to compress data;
  • deflate: a compression format based on Zlib and the deflate compression algorithm;
  • br: a compression format using 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.

See also

Generate code snippets for Node.js and other programming languages

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

// try get IpInfo ASAP! getIpInfo($.noop);