You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Options are the same as `window.fetch`, with some exceptions.
28
+
Custom Ky options
29
29
*/
30
-
exportinterfaceOptionsextendsOmit<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`.
31
-
/**
32
-
HTTP method used to make the request.
33
-
34
-
Internally, the standard methods (`GET`, `POST`, `PUT`, `PATCH`, `HEAD` and `DELETE`) are uppercased in order to avoid server errors due to case sensitivity.
35
-
*/
36
-
method?: LiteralUnion<HttpMethod,string>;
37
-
38
-
/**
39
-
HTTP headers used to make the request.
40
-
41
-
You can pass a `Headers` instance or a plain object.
42
-
43
-
You can remove a header with `.extend()` by passing the header with an `undefined` value.
44
-
45
-
@example
46
-
```
47
-
import ky from 'ky';
48
-
49
-
const url = 'https://sindresorhus.com';
50
-
51
-
const original = ky.create({
52
-
headers: {
53
-
rainbow: 'rainbow',
54
-
unicorn: 'unicorn'
55
-
}
56
-
});
57
-
58
-
const extended = original.extend({
59
-
headers: {
60
-
rainbow: undefined
61
-
}
62
-
});
63
-
64
-
const response = await extended(url).json();
65
-
66
-
console.log('rainbow' in response);
67
-
//=> false
68
-
69
-
console.log('unicorn' in response);
70
-
//=> true
71
-
```
72
-
*/
73
-
headers?: KyHeadersInit;
74
30
31
+
exporttypeKyOptions={
75
32
/**
76
33
Shortcut for sending JSON. Use this instead of the `body` option.
Options are the same as `window.fetch`, except for the KyOptions
192
+
*/
193
+
exportinterfaceOptionsextendsKyOptions,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`.
194
+
/**
195
+
HTTP method used to make the request.
196
+
197
+
Internally, the standard methods (`GET`, `POST`, `PUT`, `PATCH`, `HEAD` and `DELETE`) are uppercased in order to avoid server errors due to case sensitivity.
198
+
*/
199
+
method?: LiteralUnion<HttpMethod,string>;
200
+
201
+
/**
202
+
HTTP headers used to make the request.
203
+
204
+
You can pass a `Headers` instance or a plain object.
205
+
206
+
You can remove a header with `.extend()` by passing the header with an `undefined` value.
0 commit comments