1- import { del , get , head , options , patch , post , put } from "mokapi/http" ;
1+ import { del , get , head , options , patch , post , put , fetch } from "mokapi/http" ;
22
33// @ts -expect-error
44get ( ) ;
@@ -8,7 +8,10 @@ get("http://foo.bar");
88// @ts -expect-error
99get ( "" , 123 ) ;
1010get ( "" , { } ) ;
11- get ( "" , { header : { "Accept" : "application/json" } } ) ;
11+ get ( "" , { headers : { "Accept" : "application/json" } } ) ;
12+ get ( "" , { maxRedirects : 3 } ) ;
13+ get ( "http://foo.bar" , { timeout : 3000 } ) ;
14+ get ( "http://foo.bar" , { timeout : "3s" } ) ;
1215
1316// @ts -expect-error
1417post ( ) ;
@@ -19,7 +22,10 @@ post("", 123);
1922post ( "" , { foo : "bar" } ) ;
2023// @ts -expect-error
2124post ( "" , { } , 123 ) ;
22- post ( "" , "" , { header : { "Accept" : "application/json" } } ) ;
25+ post ( "" , "" , { headers : { "Accept" : "application/json" } } ) ;
26+ post ( "" , undefined , { maxRedirects : 3 } ) ;
27+ post ( "http://foo.bar" , undefined , { timeout : 3000 } ) ;
28+ post ( "http://foo.bar" , undefined , { timeout : "3s" } ) ;
2329
2430// @ts -expect-error
2531put ( ) ;
@@ -30,14 +36,20 @@ put("", 123);
3036put ( "" , { foo : "bar" } ) ;
3137// @ts -expect-error
3238put ( "" , { } , 123 ) ;
33- put ( "" , "" , { header : { "Accept" : "application/json" } } ) ;
39+ put ( "" , "" , { headers : { "Accept" : "application/json" } } ) ;
40+ put ( "" , undefined , { maxRedirects : 3 } ) ;
41+ put ( "http://foo.bar" , undefined , { timeout : 3000 } ) ;
42+ put ( "http://foo.bar" , undefined , { timeout : "3s" } ) ;
3443
3544// @ts -expect-error
3645head ( ) ;
3746// @ts -expect-error
3847head ( 123 ) ;
3948head ( "http://foo.bar" ) ;
40- head ( "" , { header : { "Accept" : "application/json" } } ) ;
49+ head ( "" , { headers : { "Accept" : "application/json" } } ) ;
50+ head ( "" , { maxRedirects : 3 } ) ;
51+ head ( "http://foo.bar" , { timeout : 3000 } ) ;
52+ head ( "http://foo.bar" , { timeout : "3s" } ) ;
4153
4254// @ts -expect-error
4355patch ( ) ;
@@ -48,7 +60,10 @@ patch("", 123);
4860patch ( "" , { foo : "bar" } ) ;
4961// @ts -expect-error
5062patch ( "" , { } , 123 ) ;
51- patch ( "" , "" , { header : { "Accept" : "application/json" } } ) ;
63+ patch ( "" , "" , { headers : { "Accept" : "application/json" } } ) ;
64+ patch ( "" , undefined , { maxRedirects : 3 } ) ;
65+ patch ( "http://foo.bar" , undefined , { timeout : 3000 } ) ;
66+ patch ( "http://foo.bar" , undefined , { timeout : "3s" } ) ;
5267
5368// @ts -expect-error
5469del ( ) ;
@@ -59,7 +74,10 @@ del("", 123);
5974del ( "" , { foo : "bar" } ) ;
6075// @ts -expect-error
6176del ( "" , { } , 123 ) ;
62- del ( "" , "" , { header : { "Accept" : "application/json" } } ) ;
77+ del ( "" , "" , { headers : { "Accept" : "application/json" } } ) ;
78+ del ( "" , undefined , { maxRedirects : 3 } ) ;
79+ del ( "http://foo.bar" , undefined , { timeout : 3000 } ) ;
80+ del ( "http://foo.bar" , undefined , { timeout : "3s" } ) ;
6381
6482// @ts -expect-error
6583options ( ) ;
@@ -70,4 +88,20 @@ options("", 123);
7088options ( "" , { foo : "bar" } ) ;
7189// @ts -expect-error
7290options ( "" , { } , 123 ) ;
73- options ( "" , "" , { header : { "Accept" : "application/json" } } ) ;
91+ options ( "" , "" , { headers : { "Accept" : "application/json" } } ) ;
92+ options ( "" , { maxRedirects : 3 } ) ;
93+ options ( "http://foo.bar" , undefined , { timeout : 3000 } ) ;
94+ options ( "http://foo.bar" , undefined , { timeout : "3s" } ) ;
95+
96+ // @ts -expect-error
97+ fetch ( ) ;
98+ fetch ( "http://foo.bar" ) ;
99+ fetch ( "http://foo.bar" , { } ) ;
100+ fetch ( "http://foo.bar" , { method : "POST" } ) ;
101+ // @ts -expect-error
102+ fetch ( "http://foo.bar" , { method : 12 } ) ;
103+ fetch ( "http://foo.bar" , { headers : { "Accept" : "application/json" } } ) ;
104+ fetch ( "http://foo.bar" , { body : { foo : "bar" } } ) ;
105+ fetch ( "http://foo.bar" , { maxRedirects : 1 } ) ;
106+ fetch ( "http://foo.bar" , { timeout : 3000 } ) ;
107+ fetch ( "http://foo.bar" , { timeout : "3s" } ) ;
0 commit comments