New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@octokit/request

Package Overview
Dependencies
Maintainers
0
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/request - npm Package Compare versions

Comparing version 9.1.3 to 9.1.4

23

dist-bundle/index.js

@@ -17,2 +17,5 @@ // pkg/dist-src/index.js

// pkg/dist-src/fetch-wrapper.js
import { safeParse } from "fast-content-type-parse";
// pkg/dist-src/is-plain-object.js

@@ -130,9 +133,19 @@ function isPlainObject(value) {

const contentType = response.headers.get("content-type");
if (/application\/json/.test(contentType)) {
return response.json().catch(() => response.text()).catch(() => "");
if (!contentType) {
return response.text().catch(() => "");
}
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
return response.text();
const mimetype = safeParse(contentType);
if (mimetype.type === "application/json") {
let text = "";
try {
text = await response.text();
return JSON.parse(text);
} catch (err) {
return text;
}
} else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
return response.text().catch(() => "");
} else {
return response.arrayBuffer().catch(() => new ArrayBuffer(0));
}
return response.arrayBuffer();
}

@@ -139,0 +152,0 @@ function toErrorMessage(data) {

@@ -0,1 +1,2 @@

import { safeParse } from "fast-content-type-parse";
import { isPlainObject } from "./is-plain-object.js";

@@ -103,9 +104,19 @@ import { RequestError } from "@octokit/request-error";

const contentType = response.headers.get("content-type");
if (/application\/json/.test(contentType)) {
return response.json().catch(() => response.text()).catch(() => "");
if (!contentType) {
return response.text().catch(() => "");
}
if (!contentType || /^text\/|charset=utf-8$/.test(contentType)) {
return response.text();
const mimetype = safeParse(contentType);
if (mimetype.type === "application/json") {
let text = "";
try {
text = await response.text();
return JSON.parse(text);
} catch (err) {
return text;
}
} else if (mimetype.type.startsWith("text/") || mimetype.parameters.charset?.toLowerCase() === "utf-8") {
return response.text().catch(() => "");
} else {
return response.arrayBuffer().catch(() => new ArrayBuffer(0));
}
return response.arrayBuffer();
}

@@ -112,0 +123,0 @@ function toErrorMessage(data) {

@@ -1,4 +0,4 @@

const VERSION = "9.1.3";
const VERSION = "9.1.4";
export {
VERSION
};

@@ -1,1 +0,1 @@

export declare const VERSION = "9.1.3";
export declare const VERSION = "9.1.4";
{
"name": "@octokit/request",
"version": "9.1.3",
"version": "9.1.4",
"type": "module",

@@ -22,3 +22,4 @@ "publishConfig": {

"@octokit/request-error": "^6.0.1",
"@octokit/types": "^13.1.0",
"@octokit/types": "^13.6.2",
"fast-content-type-parse": "^2.0.0",
"universal-user-agent": "^7.0.2"

@@ -28,9 +29,9 @@ },

"@octokit/auth-app": "^7.0.0",
"@octokit/tsconfig": "^3.0.0",
"@types/node": "^20.0.0",
"@octokit/tsconfig": "^4.0.0",
"@types/node": "^22.0.0",
"@vitest/coverage-v8": "^2.0.0",
"esbuild": "^0.23.0",
"fetch-mock": "^10.0.0",
"glob": "^10.2.4",
"prettier": "3.3.3",
"esbuild": "^0.24.0",
"fetch-mock": "^12.0.0",
"glob": "^11.0.0",
"prettier": "3.4.2",
"semantic-release-plugin-update-version-in-files": "^1.0.0",

@@ -37,0 +38,0 @@ "typescript": "^5.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