Comparing version 0.31.3 to 0.31.4
@@ -1,3 +0,4 @@ | ||
export declare const supportsStreams: boolean; | ||
export declare const supportsRequestStreams: boolean; | ||
export declare const supportsAbortController: boolean; | ||
export declare const supportsResponseStreams: boolean; | ||
export declare const supportsFormData: boolean; | ||
@@ -4,0 +5,0 @@ export declare const requestMethods: readonly ["get", "post", "put", "patch", "head", "delete"]; |
@@ -1,2 +0,2 @@ | ||
export const supportsStreams = (() => { | ||
export const supportsRequestStreams = (() => { | ||
let duplexAccessed = false; | ||
@@ -19,2 +19,3 @@ let hasContentType = false; | ||
export const supportsAbortController = typeof globalThis.AbortController === 'function'; | ||
export const supportsResponseStreams = typeof globalThis.ReadableStream === 'function'; | ||
export const supportsFormData = typeof globalThis.FormData === 'function'; | ||
@@ -21,0 +22,0 @@ export const requestMethods = ['get', 'post', 'put', 'patch', 'head', 'delete']; |
@@ -6,3 +6,3 @@ import { HTTPError } from '../errors/HTTPError.js'; | ||
import { delay, timeout } from '../utils/time.js'; | ||
import { maxSafeTimeout, responseTypes, stop, supportsAbortController, supportsFormData, supportsStreams } from './constants.js'; | ||
import { maxSafeTimeout, responseTypes, stop, supportsAbortController, supportsFormData, supportsResponseStreams, supportsRequestStreams, } from './constants.js'; | ||
export class Ky { | ||
@@ -83,3 +83,3 @@ // eslint-disable-next-line complexity | ||
this.request = new globalThis.Request(this._input, this._options); | ||
if (supportsStreams) { | ||
if (supportsRequestStreams) { | ||
// @ts-expect-error - Types are outdated. | ||
@@ -141,3 +141,3 @@ this.request.duplex = 'half'; | ||
} | ||
if (!supportsStreams) { | ||
if (!supportsResponseStreams) { | ||
throw new Error('Streams are not supported in your environment. `ReadableStream` is missing.'); | ||
@@ -144,0 +144,0 @@ } |
{ | ||
"name": "ky", | ||
"version": "0.31.3", | ||
"version": "0.31.4", | ||
"description": "Tiny and elegant HTTP client based on the browser Fetch API", | ||
@@ -21,3 +21,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && npm run build && ava", | ||
"test": "xo && npm run build && ava --timeout=2m --serial", | ||
"debug": "PWDEBUG=1 ava --timeout=2m", | ||
@@ -58,20 +58,20 @@ "release": "np", | ||
"@types/busboy": "^0.3.1", | ||
"@types/express": "^4.17.13", | ||
"@types/express": "^4.17.14", | ||
"@types/node-fetch": "^2.6.2", | ||
"abort-controller": "^3.0.0", | ||
"ava": "4.3.0", | ||
"body-parser": "^1.20.0", | ||
"ava": "^4.3.3", | ||
"body-parser": "^1.20.1", | ||
"busboy": "^0.3.1", | ||
"del-cli": "^4.0.1", | ||
"delay": "^5.0.0", | ||
"express": "^4.18.1", | ||
"expect-type": "^0.14.2", | ||
"express": "^4.18.2", | ||
"form-data": "^4.0.0", | ||
"node-fetch": "^2.6.1", | ||
"pify": "^6.1.0", | ||
"playwright-chromium": "^1.22.2", | ||
"playwright-chromium": "^1.27.1", | ||
"raw-body": "^2.5.1", | ||
"ts-node": "^10.8.1", | ||
"typescript": "~4.7.4", | ||
"xo": "^0.50.0", | ||
"expect-type": "^0.13.0" | ||
"typescript": "^4.8.4", | ||
"xo": "^0.50.0" | ||
}, | ||
@@ -78,0 +78,0 @@ "sideEffects": false, |
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
131449
1007