@@ -2,7 +2,7 @@ import assert from 'tjs:assert';
2
2
3
3
4
4
async function basicFetch ( ) {
5
- const r = await fetch ( 'https://httpbin.org /get' ) ;
5
+ const r = await fetch ( 'https://postman-echo.com /get' ) ;
6
6
assert . eq ( r . status , 200 , 'status is 200' ) ;
7
7
} ;
8
8
@@ -13,15 +13,15 @@ async function abortFetch() {
13
13
controller . abort ( ) ;
14
14
} , 500 ) ;
15
15
try {
16
- await fetch ( 'https://httpbin.org /delay/3' , { signal } ) ;
16
+ await fetch ( 'https://postman-echo.com /delay/3' , { signal } ) ;
17
17
} catch ( e ) {
18
18
assert . eq ( e . name , 'AbortError' , 'fetch was aborted' ) ;
19
19
}
20
20
} ;
21
21
22
22
async function fetchWithPostAndBody ( ) {
23
23
const data = JSON . stringify ( { foo : 'bar' , bar : 'baz' } ) ;
24
- const r = await fetch ( 'https://httpbin.org /post' , {
24
+ const r = await fetch ( 'https://postman-echo.com /post' , {
25
25
method : 'POST' ,
26
26
headers : {
27
27
'Content-Type' : 'application/json'
@@ -30,7 +30,7 @@ async function fetchWithPostAndBody() {
30
30
} ) ;
31
31
assert . eq ( r . status , 200 , 'status is 200' ) ;
32
32
const json = await r . json ( ) ;
33
- assert . eq ( json . data , data , 'sent and received data match' ) ;
33
+ assert . eq ( JSON . stringify ( json . data ) , data , 'sent and received data match' ) ;
34
34
} ;
35
35
36
36
0 commit comments