You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

fetch-http2

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-http2 - npm Package Compare versions

Comparing version

to
1.1.0

1

dist/fetch.d.ts

@@ -18,2 +18,3 @@ /// <reference types="node" />

readonly status: number;
readonly statusText: string;
readonly url: string;

@@ -20,0 +21,0 @@ readonly body: ClientHttp2Stream;

3

dist/fetch.js

@@ -20,3 +20,4 @@ "use strict";

status: res.status,
ok: res.status >= 200 && res.status < 400,
statusText: res.statusText,
ok: res.status >= 200 && res.status < 300,
url: url.href,

@@ -23,0 +24,0 @@ body: res.body,

@@ -8,2 +8,3 @@ /// <reference types="node" />

status: number;
statusText: string;
headers: IncomingHttpHeaders;

@@ -10,0 +11,0 @@ body: ClientHttp2Stream;

@@ -30,4 +30,7 @@ "use strict";

const { headers, status } = await _responseHeaders(req, options);
// Get status text
const statusText = getStatusText(status);
return {
status,
statusText,
headers,

@@ -112,1 +115,67 @@ body: req,

}
function getStatusText(statusCode) {
const httpStatuses = {
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing',
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
205: 'Reset Content',
206: 'Partial Content',
207: 'Multi-Status',
208: 'Already Reported',
226: 'IM Used',
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Found',
303: 'See Other',
304: 'Not Modified',
305: 'Use Proxy',
307: 'Temporary Redirect',
308: 'Permanent Redirect',
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Payload Too Large',
414: 'URI Too Long',
415: 'Unsupported Media Type',
416: 'Range Not Satisfiable',
417: 'Expectation Failed',
418: "I'm a teapot",
421: 'Misdirected Request',
422: 'Unprocessable Entity',
423: 'Locked',
424: 'Failed Dependency',
425: 'Too Early',
426: 'Upgrade Required',
428: 'Precondition Required',
429: 'Too Many Requests',
431: 'Request Header Fields Too Large',
451: 'Unavailable For Legal Reasons',
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
506: 'Variant Also Negotiates',
507: 'Insufficient Storage',
508: 'Loop Detected',
510: 'Not Extended',
511: 'Network Authentication Required'
};
return httpStatuses[statusCode] || 'Unknown';
}
{
"name": "fetch-http2",
"version": "1.0.5",
"version": "1.1.0",
"description": "Native http2 fetch implementation for Node.js",
"author": "Andrew Barba <barba@hey.com>",
"license": "MIT",
"main": "dist/fetch.js",

@@ -7,0 +8,0 @@ "types": "dist/fetch.d.ts",