Socket
Socket
Sign inDemoInstall

@octokit/request-error

Package Overview
Dependencies
Maintainers
4
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/request-error - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

29

dist-node/index.js

@@ -15,29 +15,22 @@ 'use strict';

*/
class RequestError extends Error {
constructor(message, statusCode, options) {
super(message); // Maintains proper stack trace (only available on V8)
super(message);
// Maintains proper stack trace (only available on V8)
/* istanbul ignore next */
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "HttpError";
this.status = statusCode;
let headers;
if ("headers" in options && typeof options.headers !== "undefined") {
headers = options.headers;
}
if ("response" in options) {
this.response = options.response;
headers = options.response.headers;
} // redact request credentials without mutating original request options
}
// redact request credentials without mutating original request options
const requestCopy = Object.assign({}, options.request);
if (options.request.headers.authorization) {

@@ -48,10 +41,11 @@ requestCopy.headers = Object.assign({}, options.request.headers, {

}
requestCopy.url = requestCopy.url // client_id & client_secret can be passed as URL query parameters to increase rate limit
requestCopy.url = requestCopy.url
// client_id & client_secret can be passed as URL query parameters to increase rate limit
// see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications
.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]") // OAuth tokens can be passed as URL query parameters, although it is not recommended
.replace(/\bclient_secret=\w+/g, "client_secret=[REDACTED]")
// OAuth tokens can be passed as URL query parameters, although it is not recommended
// see https://developer.github.com/v3/#oauth2-token-sent-in-a-header
.replace(/\baccess_token=\w+/g, "access_token=[REDACTED]");
this.request = requestCopy; // deprecations
this.request = requestCopy;
// deprecations
Object.defineProperty(this, "code", {

@@ -62,3 +56,2 @@ get() {

}
});

@@ -70,6 +63,4 @@ Object.defineProperty(this, "headers", {

}
});
}
}

@@ -76,0 +67,0 @@

import { RequestOptions, ResponseHeaders, OctokitResponse } from "@octokit/types";
export declare type RequestErrorOptions = {
export type RequestErrorOptions = {
/** @deprecated set `response` instead */

@@ -4,0 +4,0 @@ headers?: ResponseHeaders;

{
"name": "@octokit/request-error",
"description": "Error class for Octokit request errors",
"version": "3.0.2",
"version": "3.0.3",
"license": "MIT",

@@ -24,3 +24,3 @@ "files": [

"dependencies": {
"@octokit/types": "^8.0.0",
"@octokit/types": "^9.0.0",
"deprecation": "^2.0.0",

@@ -36,7 +36,7 @@ "once": "^1.4.0"

"@types/jest": "^29.0.0",
"@types/node": "^16.0.0",
"@types/node": "^18.0.0",
"@types/once": "^1.4.0",
"jest": "^29.0.0",
"pika-plugin-unpkg-field": "^1.1.0",
"prettier": "2.7.1",
"prettier": "2.8.3",
"ts-jest": "^29.0.0",

@@ -43,0 +43,0 @@ "typescript": "^4.0.0"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc