Comparing version 4.0.2 to 4.0.3
@@ -0,1 +1,8 @@ | ||
## [4.0.3](https://github.com/alexghr/got-fetch/compare/v4.0.2...v4.0.3) (2021-12-14) | ||
### Bug Fixes | ||
* lint ([#58](https://github.com/alexghr/got-fetch/issues/58)) ([816326f](https://github.com/alexghr/got-fetch/commit/816326f5d0c53be64c18ad2cbd9abfc834cf078d)) | ||
## [4.0.2](https://github.com/alexghr/got-fetch/compare/v4.0.1...v4.0.2) (2021-12-14) | ||
@@ -2,0 +9,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createFetch = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -10,17 +11,17 @@ const stream_1 = require("stream"); | ||
const globalCache = new Map(); | ||
return (input, opts) => tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return (input, opts) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const url = new url_1.URL(typeof input === 'string' ? input : input.url); | ||
const request = typeof input === 'object' ? input : opts || {}; | ||
if (request.mode === 'no-cors' || request.mode === 'same-origin' || request.mode === 'navigate') { | ||
throw new TypeError(util_1.format('request.mode not supported: %s', request.mode)); | ||
throw new TypeError((0, util_1.format)('request.mode not supported: %s', request.mode)); | ||
} | ||
if (request.cache === 'only-if-cached') { | ||
throw new TypeError(util_1.format('request.cache not supported: %s', request.cache)); | ||
throw new TypeError((0, util_1.format)('request.cache not supported: %s', request.cache)); | ||
} | ||
if (request.redirect === 'error' || request.redirect === 'manual') { | ||
throw new TypeError(util_1.format('request.redirect not supported: %s', request.redirect)); | ||
throw new TypeError((0, util_1.format)('request.redirect not supported: %s', request.redirect)); | ||
} | ||
// naive check to make sure headers are a plain object | ||
if (request.headers && typeof request.headers !== 'object') { | ||
throw new TypeError(util_1.format('request.headers must be plain object: %j', request.headers)); | ||
throw new TypeError((0, util_1.format)('request.headers must be plain object: %j', request.headers)); | ||
} | ||
@@ -120,24 +121,2 @@ // got does not merge base searchParams with the url's searchParams | ||
} | ||
function appendSearchParams(searchParams, extra) { | ||
if (!extra) { | ||
return; | ||
} | ||
if (typeof extra === 'string') { | ||
extra = new url_1.URLSearchParams(extra); | ||
} | ||
if (extra instanceof url_1.URLSearchParams) { | ||
extra.forEach((value, name) => { | ||
if (!searchParams.has(name)) { | ||
searchParams.set(name, value); | ||
} | ||
}); | ||
} | ||
else { | ||
Object.entries(extra).forEach(([name, value]) => { | ||
if (!searchParams.has(name)) { | ||
searchParams.set(name, String(value)); | ||
} | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=fetch.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const got_1 = tslib_1.__importDefault(require("got")); | ||
const got_1 = (0, tslib_1.__importDefault)(require("got")); | ||
const fetch_1 = require("./fetch"); | ||
exports.default = fetch_1.createFetch(got_1.default); | ||
exports.default = (0, fetch_1.createFetch)(got_1.default); | ||
//# sourceMappingURL=global-fetch.js.map |
@@ -12,3 +12,3 @@ export declare type GotHeadersGuard = 'immutable' | 'none'; | ||
set(name: string, value: string): void; | ||
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void; | ||
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: unknown): void; | ||
entries(): IterableIterator<[string, string]>; | ||
@@ -15,0 +15,0 @@ keys(): IterableIterator<string>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GotHeaders = void 0; | ||
class GotHeaders { | ||
@@ -33,3 +34,2 @@ constructor(headers, guard = 'none') { | ||
} | ||
; | ||
get(name) { | ||
@@ -39,7 +39,5 @@ const values = this.headers.get(name.toLowerCase()); | ||
} | ||
; | ||
has(name) { | ||
return this.headers.has(name.toLowerCase()); | ||
} | ||
; | ||
set(name, value) { | ||
@@ -49,3 +47,2 @@ this.checkGuard(); | ||
} | ||
; | ||
forEach(callbackfn, thisArg) { | ||
@@ -56,5 +53,4 @@ this.headers.forEach((val, name) => { | ||
} | ||
; | ||
*entries() { | ||
for (let key of this.headers.keys()) { | ||
for (const key of this.headers.keys()) { | ||
yield [key, this.get(key)]; | ||
@@ -67,3 +63,3 @@ } | ||
*values() { | ||
for (let key of this.headers.keys()) { | ||
for (const key of this.headers.keys()) { | ||
yield this.get(key); | ||
@@ -70,0 +66,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fetch = exports.createFetch = void 0; | ||
const tslib_1 = require("tslib"); | ||
const fetch_1 = require("./fetch"); | ||
exports.createFetch = fetch_1.createFetch; | ||
const global_fetch_1 = tslib_1.__importDefault(require("./global-fetch")); | ||
Object.defineProperty(exports, "createFetch", { enumerable: true, get: function () { return fetch_1.createFetch; } }); | ||
const global_fetch_1 = (0, tslib_1.__importDefault)(require("./global-fetch")); | ||
exports.fetch = global_fetch_1.default; | ||
exports.default = global_fetch_1.default; | ||
//# sourceMappingURL=index.js.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GotFetchResponse = void 0; | ||
const util_1 = require("util"); | ||
@@ -13,3 +14,3 @@ const headers_1 = require("./headers"); | ||
if (init && typeof init.status === 'number' && (init.status < 200 || init.status > 599)) { | ||
throw new RangeError(util_1.format('init.status is out of range: %s', init.status)); | ||
throw new RangeError((0, util_1.format)('init.status is out of range: %s', init.status)); | ||
} | ||
@@ -44,2 +45,3 @@ this.body = body; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
json() { | ||
@@ -46,0 +48,0 @@ return this.text().then(JSON.parse); |
{ | ||
"name": "got-fetch", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"license": "MIT", | ||
@@ -24,3 +24,3 @@ "description": "A fetch-compatible interface to the got HTTP client", | ||
"postclean": "rm -rf ./out", | ||
"lint": "eslint", | ||
"lint": "eslint .", | ||
"prepublish": "$npm_execpath run build", | ||
@@ -43,10 +43,10 @@ "pretest": "$npm_execpath run build:test", | ||
"@semantic-release/release-notes-generator": "^10.0.2", | ||
"@types/jest": "^25.2.1", | ||
"@types/jest": "^27.0.3", | ||
"@types/nock": "^11.1.0", | ||
"@types/node": "^16.11.12", | ||
"@typescript-eslint/eslint-plugin": "^2.29.0", | ||
"@typescript-eslint/parser": "^2.29.0", | ||
"@typescript-eslint/eslint-plugin": "^5.7.0", | ||
"@typescript-eslint/parser": "^5.7.0", | ||
"concurrently": "^6.4.0", | ||
"cz-conventional-changelog": "3.3.0", | ||
"eslint": "^6.8.0", | ||
"eslint": "^8.4.1", | ||
"got": "^11.0.2", | ||
@@ -56,3 +56,3 @@ "jest": "^27.4.3", | ||
"semantic-release": "^18.0.0", | ||
"typescript": "^3.8.3" | ||
"typescript": "^4.5.4" | ||
}, | ||
@@ -59,0 +59,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
21687
21
362