Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ky

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ky - npm Package Compare versions

Comparing version 0.31.4 to 0.32.0

distribution/errors/DOMException.d.ts

12

distribution/core/Ky.js

@@ -5,3 +5,4 @@ import { HTTPError } from '../errors/HTTPError.js';

import { normalizeRequestMethod, normalizeRetryOptions } from '../utils/normalize.js';
import { delay, timeout } from '../utils/time.js';
import timeout from '../utils/timeout.js';
import delay from '../utils/delay.js';
import { maxSafeTimeout, responseTypes, stop, supportsAbortController, supportsFormData, supportsResponseStreams, supportsRequestStreams, } from './constants.js';

@@ -76,4 +77,5 @@ export class Ky {

if (this._options.signal) {
const originalSignal = this._options.signal;
this._options.signal.addEventListener('abort', () => {
this.abortController.abort();
this.abortController.abort(originalSignal.reason);
});

@@ -160,2 +162,6 @@ }

}
const contentLength = response.headers.get('Content-Length');
if (contentLength === null || contentLength === '0') {
return '';
}
if (options.parseJson) {

@@ -214,3 +220,3 @@ return options.parseJson(await response.text());

if (ms !== 0 && this._retryCount > 0) {
await delay(ms);
await delay(ms, { signal: this._options.signal });
for (const hook of this._options.hooks.beforeRetry) {

@@ -217,0 +223,0 @@ // eslint-disable-next-line no-await-in-loop

/**
Returns a `Response` object with `Body` methods added for convenience. So you can, for example, call `ky.get(input).json()` directly without having to await the `Response` first. When called like that, an appropriate `Accept` header will be set depending on the body method used. Unlike the `Body` methods of `window.Fetch`; these will throw an `HTTPError` if the response status is not in the range of `200...299`. Also, `.json()` will return an empty string if the response status is `204` instead of throwing a parse error due to an empty body.
Returns a `Response` object with `Body` methods added for convenience. So you can, for example, call `ky.get(input).json()` directly without having to await the `Response` first. When called like that, an appropriate `Accept` header will be set depending on the body method used. Unlike the `Body` methods of `window.Fetch`; these will throw an `HTTPError` if the response status is not in the range of `200...299`. Also, `.json()` will return an empty string if body is empty or the response status is `204` instead of throwing a parse error due to an empty body.
*/

@@ -4,0 +4,0 @@ import { KyResponse } from './response.js';

{
"name": "ky",
"version": "0.31.4",
"version": "0.32.0",
"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 --timeout=2m --serial",
"test": "xo && npm run build && ava --timeout=10m --serial",
"debug": "PWDEBUG=1 ava --timeout=2m",

@@ -59,2 +59,3 @@ "release": "np",

"@types/express": "^4.17.14",
"@types/node": "^18.11.7",
"@types/node-fetch": "^2.6.2",

@@ -61,0 +62,0 @@ "abort-controller": "^3.0.0",

@@ -99,3 +99,3 @@ <div align="center">

Returns a [`Response` object](https://developer.mozilla.org/en-US/docs/Web/API/Response) with [`Body` methods](https://developer.mozilla.org/en-US/docs/Web/API/Body#Methods) added for convenience. So you can, for example, call `ky.get(input).json()` directly without having to await the `Response` first. When called like that, an appropriate `Accept` header will be set depending on the body method used. Unlike the `Body` methods of `window.Fetch`; these will throw an `HTTPError` if the response status is not in the range of `200...299`. Also, `.json()` will return an empty string if the response status is `204` instead of throwing a parse error due to an empty body.
Returns a [`Response` object](https://developer.mozilla.org/en-US/docs/Web/API/Response) with [`Body` methods](https://developer.mozilla.org/en-US/docs/Web/API/Body#Methods) added for convenience. So you can, for example, call `ky.get(input).json()` directly without having to await the `Response` first. When called like that, an appropriate `Accept` header will be set depending on the body method used. Unlike the `Body` methods of `window.Fetch`; these will throw an `HTTPError` if the response status is not in the range of `200...299`. Also, `.json()` will return an empty string if body is empty or the response status is `204` instead of throwing a parse error due to an empty body.

@@ -102,0 +102,0 @@ ### ky.get(input, options?)

Sorry, the diff of this file is not supported yet

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