@@ -4,114 +4,104 @@ import './vuex'
44
55type Omit < T , K extends keyof T > = Pick < T , Exclude < keyof T , K > > ;
66
7- type JSONObject = { [ key : string ] : JSONValue } ;
8- interface JSONArray extends Array < JSONValue > { }
9- type JSONValue = string | number | boolean | null | JSONObject | JSONArray ;
10-
11- interface OptionsWithoutBody extends Omit < Options , 'body' > {
12- method ?: 'get' | 'head'
13- }
14-
15- interface OptionsWithBody extends Options {
16- method ?: 'post' | 'put' | 'delete'
17- }
7+ type RequestBody = string | number | boolean | null | object | BodyInit
188
199interface NuxtHTTPInstance {
2010 /**
21- * Fetches the `input` URL with the option `{method: 'get'}`.
11+ * Fetches the `url` with the option `{method: 'get'}`.
2212 *
23- * @param input - `Request` object, `URL` object, or URL string.
13+ * @param url - `Request` object, `URL` object, or URL string.
2414 * @returns Promise with `Body` method added.
2515 */
26- get ( input : Request | URL | string , options ?: Omit < Options , 'body' > ) : ResponsePromise ;
16+ get ( url : Request | URL | string , options ?: Omit < Options , 'body' > ) : ResponsePromise ;
2717
2818 /**
29- * Fetches the `input` URL with the option `{method: 'post'}`.
19+ * Fetches the `url` with the option `{method: 'post'}`.
3020 *
31- * @param input - `Request` object, `URL` object, or URL string.
21+ * @param url - `Request` object, `URL` object, or URL string.
3222 * @returns Promise with `Body` method added.
3323 */
34- post ( input : Request | URL | string , options ?: Options ) : ResponsePromise ;
24+ post ( url : Request | URL | string , body ?: RequestBody , options ?: Options ) : ResponsePromise ;
3525
3626 /**
37- * Fetches the `input` URL with the option `{method: 'put'}`.
27+ * Fetches the `url` with the option `{method: 'put'}`.
3828 *
39- * @param input - `Request` object, `URL` object, or URL string.
29+ * @param url - `Request` object, `URL` object, or URL string.
4030 * @returns Promise with `Body` method added.
4131 */
42- put ( input : Request | URL | string , options ?: Options ) : ResponsePromise ;
32+ put ( url : Request | URL | string , body ?: RequestBody , options ?: Options ) : ResponsePromise ;
4333
4434 /**
45- * Fetches the `input` URL with the option `{method: 'patch'}`.
35+ * Fetches the `url` with the option `{method: 'patch'}`.
4636 *
47- * @param input - `Request` object, `URL` object, or URL string.
37+ * @param url - `Request` object, `URL` object, or URL string.
4838 * @returns Promise with `Body` method added.
4939 */
50- patch ( input : Request | URL | string , options ?: Options ) : ResponsePromise ;
40+ patch ( url : Request | URL | string , body ?: RequestBody , options ?: Options ) : ResponsePromise ;
5141
5242 /**
53- * Fetches the `input` URL with the option `{method: 'head'}`.
43+ * Fetches the `url` with the option `{method: 'head'}`.
5444 *
55- * @param input - `Request` object, `URL` object, or URL string.
45+ * @param url - `Request` object, `URL` object, or URL string.
5646 * @returns Promise with `Body` method added.
5747 */
58- head ( input : Request | URL | string , options ?: Omit < Options , 'body' > ) : ResponsePromise ;
48+ head ( url : Request | URL | string , options ?: Omit < Options , 'body' > ) : ResponsePromise ;
5949
6050 /**
61- * Fetches the `input` URL with the option `{method: 'delete'}`.
51+ * Fetches the `url` with the option `{method: 'delete'}`.
6252 *
63- * @param input - `Request` object, `URL` object, or URL string.
53+ * @param url - `Request` object, `URL` object, or URL string.
6454 * @returns Promise with `Body` method added.
6555 */
66- delete ( input : Request | URL | string , options ?: Options ) : ResponsePromise ;
56+ delete ( url : Request | URL | string , options ?: Options ) : ResponsePromise ;
6757
6858 /**
69- * Fetches the `input` URL with the option `{method: 'get'}`.
59+ * Fetches the `url` with the option `{method: 'get'}`.
7060 *
71- * @param input - `Request` object, `URL` object, or URL string.
61+ * @param url - `Request` object, `URL` object, or URL string.
7262 * @returns Promise that resolves to JSON parsed value.
7363 */
74- $get < T = JSONValue > ( input : Request | URL | string , options ?: Omit < Options , 'body' > ) : Promise < T > ;
64+ $get < T = JSONValue > ( url : Request | URL | string , options ?: Omit < Options , 'body' > ) : Promise < T > ;
7565
7666 /**
77- * Fetches the `input` URL with the option `{method: 'post'}`.
67+ * Fetches the `url` with the option `{method: 'post'}`.
7868 *
79- * @param input - `Request` object, `URL` object, or URL string.
69+ * @param url - `Request` object, `URL` object, or URL string.
8070 * @returns Promise that resolves to JSON parsed value.
8171 */
82- $post < T = JSONValue > ( input : Request | URL | string , options ?: Options ) : Promise < T > ;
72+ $post < T = JSONValue > ( url : Request | URL | string , body ?: RequestBody , options ?: Options ) : Promise < T > ;
8373
8474 /**
85- * Fetches the `input` URL with the option `{method: 'put'}`.
75+ * Fetches the `url` with the option `{method: 'put'}`.
8676 *
87- * @param input - `Request` object, `URL` object, or URL string.
77+ * @param url - `Request` object, `URL` object, or URL string.
8878 * @returns Promise that resolves to JSON parsed value.
8979 */
90- $put < T = JSONValue > ( input : Request | URL | string , options ?: Options ) : Promise < T > ;
80+ $put < T = JSONValue > ( url : Request | URL | string , body ?: RequestBody , options ?: Options ) : Promise < T > ;
9181
9282 /**
93- * Fetches the `input` URL with the option `{method: 'patch'}`.
83+ * Fetches the `url` with the option `{method: 'patch'}`.
9484 *
95- * @param input - `Request` object, `URL` object, or URL string.
85+ * @param url - `Request` object, `URL` object, or URL string.
9686 * @returns Promise that resolves to JSON parsed value.
9787 */
98- $patch < T = JSONValue > ( input : Request | URL | string , options ?: Options ) : Promise < T > ;
88+ $patch < T = JSONValue > ( url : Request | URL | string , body ?: RequestBody , options ?: Options ) : Promise < T > ;
9989
10090 /**
101- * Fetches the `input` URL with the option `{method: 'head'}`.
91+ * Fetches the `url` with the option `{method: 'head'}`.
10292 *
103- * @param input - `Request` object, `URL` object, or URL string.
93+ * @param url - `Request` object, `URL` object, or URL string.
10494 * @returns Promise that resolves to JSON parsed value.
10595 */
106- $head < T = JSONValue > ( input : Request | URL | string , options ?: Omit < Options , 'body' > ) : Promise < T > ;
96+ $head < T = JSONValue > ( url : Request | URL | string , options ?: Omit < Options , 'body' > ) : Promise < T > ;
10797
10898 /**
109- * Fetches the `input` URL with the option `{method: 'delete'}`.
99+ * Fetches the `url` with the option `{method: 'delete'}`.
110100 *
111- * @param input - `Request` object, `URL` object, or URL string.
101+ * @param url - `Request` object, `URL` object, or URL string.
112102 * @returns Promise that resolves to JSON parsed value.
113103 */
114- $delete < T = JSONValue > ( input : Request | URL | string , options ?: Options ) : Promise < T > ;
104+ $delete < T = JSONValue > ( url : Request | URL | string , options ?: Options ) : Promise < T > ;
115105
116106
117107 /**
0 commit comments