Comparing version 0.16.0 to 0.16.1
@@ -49,3 +49,2 @@ /*! MIT License © Sindre Sorhus */ | ||
const supportsStreams = typeof globals.ReadableStream === 'function'; | ||
const supportsFormData = typeof globals.FormData === 'function'; | ||
@@ -244,9 +243,5 @@ const deepMerge = (...sources) => { | ||
url.search = new URLSearchParams(this._options.searchParams); | ||
this.request = new globals.Request(url, this.request); | ||
this.request = new globals.Request(new globals.Request(url, this.request), this._options); | ||
} | ||
if (((supportsFormData && this._options.body instanceof globals.FormData) || this._options.body instanceof URLSearchParams) && this.request.headers.has('content-type')) { | ||
throw new Error(`The \`content-type\` header cannot be used with a ${this._options.body.constructor.name} body. It will be set automatically.`); | ||
} | ||
if (this._options.json) { | ||
@@ -253,0 +248,0 @@ this._options.body = JSON.stringify(this._options.json); |
{ | ||
"name": "ky", | ||
"version": "0.16.0", | ||
"version": "0.16.1", | ||
"description": "Tiny and elegant HTTP client based on the browser Fetch API", | ||
"license": "MIT", | ||
"repository": "sindresorhus/ky", | ||
"funding": "https://github.com/sindresorhus/ky?sponsor=1", | ||
"author": { | ||
@@ -8,0 +9,0 @@ "name": "Sindre Sorhus", |
@@ -184,3 +184,2 @@ <div align="center"> | ||
Type: `object | number`\ | ||
Default: | ||
@@ -421,3 +420,3 @@ - `limit`: `2` | ||
Sending form data in Ky is identical to `fetch`. Just pass a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) instance to the `body` option. The `Content-Type` header will be automatically set to `multipart/form-data`. Setting it manually will result in an error. | ||
Sending form data in Ky is identical to `fetch`. Just pass a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) instance to the `body` option. The `Content-Type` header will be automatically set to `multipart/form-data`. | ||
@@ -424,0 +423,0 @@ ```js |
@@ -55,3 +55,2 @@ (function (global, factory) { | ||
const supportsStreams = typeof globals.ReadableStream === 'function'; | ||
const supportsFormData = typeof globals.FormData === 'function'; | ||
@@ -250,9 +249,5 @@ const deepMerge = (...sources) => { | ||
url.search = new URLSearchParams(this._options.searchParams); | ||
this.request = new globals.Request(url, this.request); | ||
this.request = new globals.Request(new globals.Request(url, this.request), this._options); | ||
} | ||
if (((supportsFormData && this._options.body instanceof globals.FormData) || this._options.body instanceof URLSearchParams) && this.request.headers.has('content-type')) { | ||
throw new Error(`The \`content-type\` header cannot be used with a ${this._options.body.constructor.name} body. It will be set automatically.`); | ||
} | ||
if (this._options.json) { | ||
@@ -259,0 +254,0 @@ this._options.body = JSON.stringify(this._options.json); |
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
57799
1125
570