MCPcopy
hub / github.com/sindresorhus/ky / Options

Interface Options

source/types/options.ts:399–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397Options are the same as `window.fetch`, except for the KyOptions
398*/
399export 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
445export type InternalOptions = Required<
446 Omit<Options, 'hooks' | 'retry' | 'context' | 'throwHttpErrors'>,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…