Skip to content
Myr

Meta tweaks

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sindre Sorhus · committed by Sindre Sorhus · parent 8764419 · Browse files · 8 files+34 added−18 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

8 files+34 added−18 removed

  • tests:+11 added−3 removed
  • other:+23 added−15 removed

8 files+34 added−18 removed

modified:source/core/Ky.ts+7 added-1 removed
1import {HTTPError} from '../errors/HTTPError.js';2import {TimeoutError} from '../errors/TimeoutError.js';3import type {Hooks} from '../types/hooks.js';4import type {Input, InternalOptions, NormalizedOptions, Options, SearchParamsInit} from '../types/options.js';4import type {5 Input,6 InternalOptions,7 NormalizedOptions,8 Options,9 SearchParamsInit,10} from '../types/options.js';11import {type ResponsePromise} from '../types/ResponsePromise.js';12import {deepMerge, mergeHeaders} from '../utils/merge.js';13import {normalizeRequestMethod, normalizeRetryOptions} from '../utils/normalize.js';14import timeout, {type TimeoutOptions} from '../utils/timeout.js';
357 unmodified lines
modified:source/types/ky.ts+1 added-1 removed
modified:source/utils/delay.ts+1 added-1 removed
modified:test/helpers/with-page.ts+7 added-1 removed
modified:test/browser.ts+2 added-2 removed
1import test, {type ExecutionContext} from 'ava';2import busboy from 'busboy';3import express from 'express';4import {chromium, webkit, type Page} from 'playwright';5import type ky from '../source/index.js';6import type {DownloadProgress} from '../source/index.js';5import type ky from '../source/index.js'; // eslint-disable-line import/no-duplicates6import type {DownloadProgress} from '../source/index.js'; // eslint-disable-line import/no-duplicates7import {createHttpTestServer, type ExtendedHttpTestServer, type HttpServerOptions} from './helpers/create-http-test-server.js';8import {parseRawBody} from './helpers/parse-body.js';9import {browserTest, defaultBrowsersTest} from './helpers/with-page.js';10
477 unmodified lines
modified:test/main.ts+2 added
703 unmodified lines
704 body: requestBody,705 });706707 server.post('/', (request, response) => {708 // eslint-disable-next-line @typescript-eslint/ban-types709 const body: Buffer[] = [];710711 // eslint-disable-next-line @typescript-eslint/ban-types712 request.on('data', (chunk: Buffer) => {713 body.push(chunk);714 });715
99 unmodified lines
modified:package.json+10 added-9 removed
1{2 "name": "ky",3 "version": "1.4.0",4 "description": "Tiny and elegant HTTP client based on the browser Fetch API",4 "description": "Tiny and elegant HTTP client based on the Fetch API",5 "license": "MIT",6 "repository": "sindresorhus/ky",7 "funding": "https://github.com/sindresorhus/ky?sponsor=1",8 "author": {
44 unmodified lines
53 "axios",54 "node-fetch"55 ],56 "devDependencies": {57 "@sindresorhus/tsconfig": "^4.0.0",57 "@sindresorhus/tsconfig": "^6.0.0",58 "@type-challenges/utils": "^0.1.1",59 "@types/body-parser": "^1.19.2",60 "@types/busboy": "^1.5.0",61 "@types/express": "^4.17.17",62 "@types/node": "^20.5.7",62 "@types/node": "^20.14.12",63 "ava": "^5.3.1",64 "body-parser": "^1.20.2",65 "busboy": "^1.6.0",66 "del-cli": "^5.1.0",67 "delay": "^6.0.0",68 "expect-type": "^0.16.0",68 "expect-type": "^0.19.0",69 "express": "^4.18.2",70 "pify": "^6.1.0",71 "playwright": "^1.40.1",71 "playwright": "^1.45.3",72 "raw-body": "^2.5.2",73 "tsx": "^4.7.0",74 "typescript": "^5.2.2",75 "xo": "^0.56.0"73 "tsx": "^4.16.2",74 "typescript": "^5.5.4",75 "xo": "^0.58.0"76 },77 "xo": {78 "envs": [79 "browser"
4 unmodified lines
84 "@typescript-eslint/no-unsafe-argument": "off",85 "@typescript-eslint/no-unsafe-assignment": "off",86 "@typescript-eslint/no-unsafe-return": "off",87 "@typescript-eslint/no-unsafe-call": "off",88 "@typescript-eslint/naming-convention": "off"88 "@typescript-eslint/naming-convention": "off",89 "n/no-unsupported-features/node-builtins": "off"90 }91 },92 "ava": {93 "extensions": {
21 unmodified lines
modified:readme.md+4 added-3 removed
49 unmodified lines
50 <br>51 <br>52</div>5354> Ky is a tiny and elegant HTTP client based on the browser [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch)54> Ky is a tiny and elegant HTTP client based on the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch)5556[![Coverage Status](https://codecov.io/gh/sindresorhus/ky/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/ky)57[![](https://badgen.net/bundlephobia/minzip/ky)](https://bundlephobia.com/result?p=ky)5859Ky targets [modern browsers](#browser-support), Node.js, and Deno.59Ky targets [modern browsers](#browser-support), Node.js, Bun, and Deno.6061It's just a tiny package with no dependencies.6263## Benefits over plain `fetch`
640 unmodified lines
704705const json = await ky('https://jsonplaceholder.typicode.com/todos/1').json();706707console.log(json.title);708//=> 'delectus aut autem708//=> 'delectus aut autem'709</script>710```711712#### How is it different from [`got`](https://github.com/sindresorhus/got)
23 unmodified lines
736Node.js 18 and later.737738## Related739740- [fetch-extras](https://github.com/sindresorhus/fetch-extras) - Useful utilities for working with Fetch741- [got](https://github.com/sindresorhus/got) - Simplified HTTP requests for Node.js742- [ky-hooks-change-case](https://github.com/alice-health/ky-hooks-change-case) - Ky hooks to modify cases on requests and responses of objects743744## Maintainers
4 unmodified lines