| 397 | Options are the same as `window.fetch`, except for the KyOptions |
| 398 | */ |
| 399 | export interface Options extends KyOptions, Omit<RequestInit, 'headers'> { // eslint-disable-line @typescript-eslint/consistent-type-definitions -- This must stay an interface so that it can be extended outside of Ky for use in `ky.create`. |
| 400 | /** |
| 401 | HTTP method used to make the request. |
| 402 | |
| 403 | Internally, the standard methods (`GET`, `POST`, `PUT`, `PATCH`, `HEAD` and `DELETE`) are uppercased in order to avoid server errors due to case sensitivity. |
| 404 | */ |
| 405 | method?: LiteralUnion<HttpMethod, string>; |
| 406 | |
| 407 | /** |
| 408 | HTTP headers used to make the request. |
| 409 | |
| 410 | You can pass a `Headers` instance or a plain object. |
| 411 | |
| 412 | You can remove a header with `.extend()` by passing the header with an `undefined` value. Passing `undefined` as a string removes the header only if it comes from a `Headers` instance. |
| 413 | |
| 414 | @example |
| 415 | ``` |
| 416 | import ky from 'ky'; |
| 417 | |
| 418 | const url = 'https://sindresorhus.com'; |
| 419 | |
| 420 | const original = ky.create({ |
| 421 | headers: { |
| 422 | rainbow: 'rainbow', |
| 423 | unicorn: 'unicorn' |
| 424 | } |
| 425 | }); |
| 426 | |
| 427 | const extended = original.extend({ |
| 428 | headers: { |
| 429 | rainbow: undefined |
| 430 | } |
| 431 | }); |
| 432 | |
| 433 | const response = await extended(url).json(); |
| 434 | |
| 435 | console.log('rainbow' in response); |
| 436 | //=> false |
| 437 | |
| 438 | console.log('unicorn' in response); |
| 439 | //=> true |
| 440 | ``` |
| 441 | */ |
| 442 | headers?: KyHeadersInit; |
| 443 | } |
| 444 | |
| 445 | export type InternalOptions = Required< |
| 446 | Omit<Options, 'hooks' | 'retry' | 'context' | 'throwHttpErrors'>, |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…