@octokit/request
Advanced tools
Comparing version 7.0.0-beta.1 to 7.0.0-beta.2
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -20,10 +18,2 @@ var __export = (target, all) => { | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -41,7 +31,6 @@ | ||
// pkg/dist-src/version.js | ||
var VERSION = "7.0.0-beta.1"; | ||
var VERSION = "7.0.0-beta.2"; | ||
// pkg/dist-src/fetch-wrapper.js | ||
var import_is_plain_object = require("is-plain-object"); | ||
var import_node_fetch = __toESM(require("node-fetch")); | ||
var import_request_error = require("@octokit/request-error"); | ||
@@ -56,2 +45,3 @@ | ||
function fetchWrapper(requestOptions) { | ||
var _a; | ||
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console; | ||
@@ -64,4 +54,11 @@ if ((0, import_is_plain_object.isPlainObject)(requestOptions.body) || Array.isArray(requestOptions.body)) { | ||
let url; | ||
const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || /* istanbul ignore next */ | ||
import_node_fetch.default; | ||
let { fetch } = globalThis; | ||
if ((_a = requestOptions.request) == null ? void 0 : _a.fetch) { | ||
fetch = requestOptions.request.fetch; | ||
} | ||
if (!fetch) { | ||
throw new Error( | ||
'Global "fetch" not found. Please provide `options.request.fetch` to octokit or upgrade to node@18 or newer.' | ||
); | ||
} | ||
return fetch( | ||
@@ -68,0 +65,0 @@ requestOptions.url, |
import { isPlainObject } from "is-plain-object"; | ||
import nodeFetch from "node-fetch"; | ||
import { RequestError } from "@octokit/request-error"; | ||
@@ -13,4 +12,11 @@ import getBuffer from "./get-buffer-response"; | ||
let url; | ||
const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || /* istanbul ignore next */ | ||
nodeFetch; | ||
let { fetch } = globalThis; | ||
if (requestOptions.request?.fetch) { | ||
fetch = requestOptions.request.fetch; | ||
} | ||
if (!fetch) { | ||
throw new Error( | ||
'Global "fetch" not found. Please provide `options.request.fetch` to octokit or upgrade to node@18 or newer.' | ||
); | ||
} | ||
return fetch( | ||
@@ -17,0 +23,0 @@ requestOptions.url, |
@@ -1,4 +0,4 @@ | ||
const VERSION = "7.0.0-beta.1"; | ||
const VERSION = "7.0.0-beta.2"; | ||
export { | ||
VERSION | ||
}; |
@@ -1,2 +0,1 @@ | ||
import { Response } from "node-fetch"; | ||
export default function getBufferResponse(response: Response): Promise<ArrayBuffer>; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "7.0.0-beta.1"; | ||
export declare const VERSION = "7.0.0-beta.2"; |
@@ -6,7 +6,6 @@ // pkg/dist-src/index.js | ||
// pkg/dist-src/version.js | ||
var VERSION = "7.0.0-beta.1"; | ||
var VERSION = "7.0.0-beta.2"; | ||
// pkg/dist-src/fetch-wrapper.js | ||
import { isPlainObject } from "is-plain-object"; | ||
import nodeFetch from "node-fetch"; | ||
import { RequestError } from "@octokit/request-error"; | ||
@@ -28,4 +27,11 @@ | ||
let url; | ||
const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || /* istanbul ignore next */ | ||
nodeFetch; | ||
let { fetch } = globalThis; | ||
if (requestOptions.request?.fetch) { | ||
fetch = requestOptions.request.fetch; | ||
} | ||
if (!fetch) { | ||
throw new Error( | ||
'Global "fetch" not found. Please provide `options.request.fetch` to octokit or upgrade to node@18 or newer.' | ||
); | ||
} | ||
return fetch( | ||
@@ -32,0 +38,0 @@ requestOptions.url, |
{ | ||
"name": "@octokit/request", | ||
"version": "7.0.0-beta.1", | ||
"version": "7.0.0-beta.2", | ||
"publishConfig": { | ||
@@ -22,3 +22,2 @@ "access": "public" | ||
"is-plain-object": "^5.0.0", | ||
"node-fetch": "^2.6.7", | ||
"universal-user-agent": "^6.0.0" | ||
@@ -33,3 +32,2 @@ }, | ||
"@types/node": "^18.0.0", | ||
"@types/node-fetch": "^2.3.3", | ||
"@types/once": "^1.4.0", | ||
@@ -36,0 +34,0 @@ "esbuild": "^0.17.19", |
@@ -13,4 +13,3 @@ # request.js | ||
It uses [`@octokit/endpoint`](https://github.com/octokit/endpoint.js) to parse | ||
the passed options and sends the request using [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) | ||
([node-fetch](https://github.com/bitinn/node-fetch) when the runtime has no native `fetch` API). | ||
the passed options and sends the request using [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). You can pass a custom `fetch` function using the `options.request.fetch` option, see below. | ||
@@ -31,3 +30,3 @@ <!-- update table of contents by running `npx markdown-toc README.md -i` --> | ||
- [Special cases](#special-cases) | ||
- [The `data` parameter – set request body directly](#the-data-parameter--set-request-body-directly) | ||
- [The `data` parameter – set request body directly](#the-data-parameter-%E2%80%93-set-request-body-directly) | ||
- [Set parameters for both the URL/query and the request body](#set-parameters-for-both-the-urlquery-and-the-request-body) | ||
@@ -324,3 +323,3 @@ - [LICENSE](#license) | ||
<td> | ||
Custom replacement for <a href="https://github.com/bitinn/node-fetch">built-in fetch method</a>. Useful for testing or request hooks. | ||
Custom replacement for <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">fetch</a>. Useful for testing or request hooks. | ||
</td> | ||
@@ -360,13 +359,2 @@ </tr> | ||
</tr> | ||
<tr> | ||
<th align=left> | ||
<code>options.request.timeout</code> | ||
</th> | ||
<td> | ||
Number | ||
</td> | ||
<td> | ||
Node only. Request/response timeout in ms, it resets on redirect. 0 to disable (OS limit applies). <a href="#options-request-signal">options.request.signal</a> is recommended instead. | ||
</td> | ||
</tr> | ||
</table> | ||
@@ -373,0 +361,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5
17
566
54372
542
6
- Removednode-fetch@^2.6.7
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)