Scan your whole stack
From OX Research Newsroom
Are you using pixl-request?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2.6.15
pixl-request was last scanned on 29 Nov 2026 at version 2.6.15. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 2.6.15 LATEST | 29 Nov 2026 | No rules fired |
| 2.6.14 | 13 Nov 2026 | No rules fired |
| 2.6.13 | 5 Nov 2026 | No rules fired |
| 2.6.11 | 8 Sep 2026 | Not shown |
Findings for v2.6.15. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 2.6.15; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
This module is a very simple wrapper around Node's built-in http library for making HTTP requests. It provides an easy way to send an HTTP GET or POST, including things like support for HTTPS (SSL), file uploads and JSON REST style API calls. Compressed responses are also handled automatically.
Use npm to install the module:
npm install pixl-request
Then use require() to load it in your code:
const PixlRequest = require('pixl-request');
Instantiate a request object and pass in an optional user agent string (you can also set this later via a header):
let request = new PixlRequest( "My Custom Agent 1.0" );
Here is a simple HTTP GET example:
try {
let { data } = await request.get('https://www.bitstamp.net/api/ticker/');
console.log("Success: " + data);
}
catch (err) {
throw err;
}
The result object actually contains other properties besides data. Here is an example using all of them:
try {
let { resp, data, perf } = await request.get('https://www.bitstamp.net/api/ticker/');
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
request.get( 'https://www.bitstamp.net/api/ticker/', function(err, resp, data, perf) {
if (err) throw err;
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
And here is a simple JSON REST API request:
try {
let { resp, data, perf } = await request.json('http://myserver.com/api', {
"foo": "test",
"bar": 123
});
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
request.json( 'http://myserver.com/api', { "foo": "test", "bar": 123 }, function(err, resp, data, perf) {
if (err) throw(err);
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
Here are all the methods available in the request library:
| Method Name | Description |
|---|---|
| get() | Performs an HTTP GET request. |
| head() | Performs an HTTP HEAD request. |
| post() | Performs an HTTP POST request. |
| put() | Performs an HTTP PUT request. |
| delete() | Performs an HTTP DELETE request. |
| json() | Sends a request to a JSON REST API endpoint and parses the response. |
| xml() | Sends a request to an XML REST API endpoint and parses the response. |
| setOptions() | Replaces the default options for all future requests. |
| setHeader() | Overrides or adds a default header for future requests. |
| setTimeout() | Overrides the default time-to-first-byte timeout (milliseconds). |
| setConnectTimeout() | Overrides the default DNS + socket connect timeout (milliseconds). |
| setIdleTimeout() | Overrides the default socket idle timeout (milliseconds). |
| setFollow() | Overrides the default behavior for following redirects. |
| setRetryMatch() | Customizes which HTTP response codes trigger automatic retries. |
| setAutoDecompress() | Overrides the default behavior of decompressing responses. |
| setDNSCache() | Enable DNS caching and set the TTL in seconds. |
| flushDNSCache() | Flush all IPs from the internal DNS cache. |
Here are all the request types supported by the library.
PROMISE request.get( URL );
PROMISE request.get( URL, OPTIONS );
To perform a simple HTTP GET, call the get() method. All you need to provide is the URL, and the result is an object containing the response (headers and such), data (as a buffer), and performance data:
try {
let { resp, data, perf } = await request.get('https://www.bitstamp.net/api/ticker/');
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
request.get( 'https://www.bitstamp.net/api/ticker/', function(err, resp, data, perf) {
if (err) throw(err);
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
The result of the operation is an object containing the HTTP response object from Node (IncomingMessage), a data buffer of the content (if any), and a performance tracker.
With async or promise usage, if an error occurs it is thrown. Note that an "error" in this case is something like a TCP connection failure, DNS lookup failure, socket timeout, connection aborted, or other internal client library failure. By default, HTTP response codes like 404 or 500 are not considered errors, so make sure to look at resp.statusCode if you are expecting an HTTP 200. However, if you want non-200 response codes to be considered errors, see Automatic Errors below.
To specify additional options, such as custom request headers or HTTP authentication, include an object after the URL:
try {
let { resp, data, perf } = await request.get( 'https://www.bitstamp.net/api/ticker/', {
"headers": {
"X-Custom-Header": "My custom value"
},
"auth": "username:password"
});
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
request.get( 'https://www.bitstamp.net/api/ticker/', {
"headers": {
"X-Custom-Header": "My custom value"
},
"auth": "username:password"
},
function(err, resp, data, perf) {
if (err) throw err;
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
Check out the Node http.request() documentation for all the properties you can pass in the options object.
By default, connections are closed at the end of each request. If you want to reuse a persistent connection across multiple requests, see the Keep-Alives section below.
PROMISE request.head( URL )
PROMISE request.head( URL, OPTIONS )
An HTTP HEAD request will not contain any data in the response, only the response code and headers. Example:
try {
let { resp, perf } = await request.head( 'http://myserver.com/index.html' );
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
request.head( 'http://myserver.com/index.html', function(err, resp, data, perf) {
if (err) throw err;
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Performance: ", perf.metrics());
} );
PROMISE request.post( URL, OPTIONS )
To perform a HTTP POST, call the post() method. Provide a URL, and an options object with a data property containing your key/value pairs:
try {
let { resp, data, perf } = await request.post( 'http://myserver.com/api/post', {
"data": {
"full_name": "Fred Smith",
"gender": "male",
"age": 35
}
});
console.log("Status: " + resp.statusCode + " " + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
request.post( 'http://myserver.com/api/post', {
"data": {
"full_name": "Fred Smith",
"gender": "male",
"age": 35
}
},
function(err, resp, data, perf) {
if (err) throw err;
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
Your key/value pairs will be serialized using the application/x-www-form-urlencoded format. For a multipart post, see Multipart POST below.
The result of the operation is an object containing the HTTP response object from Node (IncomingMessage), a data buffer of the content (if any), and a performance tracker.
With async or promise usage, if an error occurs it is thrown. Note that an "error" in this case is something like a TCP connection failure, DNS lookup failure, socket timeout, connection aborted, or other internal client library failure. By default, HTTP response codes like 404 or 500 are not considered errors, so make sure to look at resp.statusCode if you are expecting an HTTP 200. However, if you want non-200 response codes to be considered errors, see Automatic Errors below.
Check out the Node http.request() documentation for all the properties you can pass in the options object.
By default, connections are closed at the end of each request. If you want to reuse a persistent connection across multiple requests, see the Keep-Alives section below.
To specify your own raw POST data without any key/value pre-formatting, simply pass a Buffer object as the data property value, then include your own Content-Type header in the headers object. Example:
let buf = Buffer.from("VGhpcyBpcyBhIHRlc3QhIPCfmJw=", "base64");
try {
let { resp, data, perf } = await request.post( 'http://myserver.com/api/post', {
"data": buf,
"headers": {
"Content-Type": "application/octet-stream"
}
});
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
let buf = Buffer.from("VGhpcyBpcyBhIHRlc3QhIPCfmJw=", "base64");
request.post( 'http://myserver.com/api/post', {
"data": buf,
"headers": {
"Content-Type": "application/octet-stream"
}
},
function(err, resp, data, perf) {
if (err) throw err;
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
For a multipart/form-data post, which is typically better for binary data, all you need to do is pass in a multipart property in your options object, and set it to a true value. Everything else is the same as a standard HTTP POST:
try {
let { resp, data, perf } = await request.post( 'http://myserver.com/api/post', {
"multipart": true, // activate multipart/form-data
"data": {
"foo": Buffer.from("Joe was here!"),
"bar": 54321
}
});
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
request.post( 'http://myserver.com/api/post', {
"multipart": true, // activate multipart/form-data
"data": {
"foo": Buffer.from("Joe was here!"),
"bar": 54321
}
},
function(err, resp, data, perf) {
if (err) throw err;
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
Note that you can use Buffer objects instead of strings for your data values.
To upload files, use post() and include a files object with your options, containing key/pair pairs. Each file needs an identifier key (POST field name), and a value which should be a path to the file on disk:
try {
let { resp, data, perf } = await request.post( 'http://myserver.com/api/upload', {
"files": {
"kitten1": "/images/SillyKitten1.jpg",
"kitten2": "/images/SillyKitten2.jpg"
}
});
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
request.post( 'http://myserver.com/api/upload', {
"files": {
"kitten1": "/images/SillyKitten1.jpg",
"kitten2": "/images/SillyKitten2.jpg"
}
},
function(err, resp, data, perf) {
if (err) throw err;
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
The file path can also be a readable stream, if you happen to have one of those already open:
let stream = fs.createReadStream('/images/SillyKitten1.jpg');
try {
let { resp, data, perf } = await request.post( 'http://myserver.com/api/upload', {
"files": {
"file1": stream
}
});
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
}
catch (err) {
throw err;
}
let stream = fs.createReadStream('/images/SillyKitten1.jpg');
request.post( 'http://myserver.com/api/upload', {
"files": {
"file1": stream
}
},
function(err, resp, data, perf) {
if (err) throw err;
console.log("Status: " + resp.statusCode + ' ' + resp.statusMessage);
console.log("Headers: ", resp.headers);
console.log("Content: " + data);
console.log("Performance: ", perf.metrics());
} );
If you want to customize the filename of the uploaded file, set your file value to an array, with the first element containing the file path (or a stream), and the second element the desired filename:
"files": {
"file1": ["/images/SillyKitten1.jpg", "A-New-Filename.JPG"]
}
You can combine file uploads with other POST data fields, just by including a data property in your options, similar to a standard HTTP POST. You can of course include any other options keys as well, such as custom headers:
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.