
Security News
Critical Security Vulnerability in React Server Components
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.
@apify/http-request
Advanced tools
Sends a HTTP request and returns the response. This package is used it Apify SDK instead of the old request
NPM package. Implements a tunnel agent error fix, better proxy agents and supports brotli compression. Fixed deflate compression.
The function has similar functionality and has nearly the same options as the got NPM package, but it brings several additional improvements and fixes:
Accept-Encoding: gzip, deflate, br to options.headers (or a combination) and set options.useBrotli to true.options.abortFunction parameter. const httpRequest = require("@apify/http-request");
const {headers, body, statusCode} = await httpRequest({ url: 'https://api.apify.com/v2/browser-info'});
const httpRequest = require("@apify/http-request");
const {headers, body, statusCode} = await httpRequest({ url: 'https://api.apify.com/v2/browser-info', json: true });
const httpRequest = require("@apify/http-request");
const responseStream = await httpRequest({ url: 'https://apify.com', stream: true});
It's a GET request by default, but can be changed by using different methods or via options.method.
Returns a Promise for a response object or a stream if options.stream is set to true.
URL of the target endpoint. Supports both HTTP and HTTPS schemes.
HTTP method. Default value is GET.
HTTP headers. Default value is {}.
Note that the function generates several headers itself, unless
they are defined in the headers parameter, in which case the function leaves them untouched.
{ 'Content-Length': null }, the function doesn't define
the 'Content-Length' header and the request will not contain it (due to the null value).HTTP payload for PATCH, POST and PUT requests. Must be a Buffer or String.
Follow HTTP 3xx responses as redirects (default: true).
The maximum number of redirects to follow. Default value is 20
Integer containing the number of seconds to wait for a server to send response headers (and start the response body) before aborting the request. Note that if the underlying TCP connection cannot be established, the OS-wide TCP connection timeout will overrule the timeout option (the default in Linux can be anywhere from 20-120 seconds).
Default value is 30.
An HTTP proxy to be used. Supports proxy authentication with Basic Auth.
If false, requires SSL/TLS certificates to be valid
Default value is false
A function that determines whether the request should be aborted. It is called when the server
responds with the HTTP headers, but before the actual data is downloaded.
class and it should return true if request should be aborted, or false otherwise.
You can also throw custom error inside the options.abortFunction.
In this case, httpRequest aborts the request and throws your custom error.
Default value is null.
If set to true function throws and error on 4XX and 5XX response codes.
Default value is false.
If set to true decoded body is returned. Cannot be set to false if the [options.parsedBody] is true.
Default value is true
If set to true parsed body is returned. And content-type header is set to application/json
It won't work if you have the options.stream set to true.
Default value is false.
If set to true decompressed stream is returned.
Default value is false
If set to true Brotli decompression is enabled. Brotli has a Node.js native support from V10.16.0. If you use older version you must have the peer dependency iltorb installed.
Default value is false
Promise<object> - The response object will typically be a
For more information please see original npm package - got.
FAQs
Wrapper of got package used across Apify
The npm package @apify/http-request receives a total of 298 weekly downloads. As such, @apify/http-request popularity was classified as not popular.
We found that @apify/http-request demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated “elf-*” npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.

Security News
TypeScript 6.0 will be the last JavaScript-based major release, as the project shifts to the TypeScript 7 native toolchain with major build speedups.