Skip to content

Commit 28b0da9

Browse files
committed
tests: replace httpbin.org with postman-echo.com
httpbin has been somewhat unreliable lately.
1 parent a2d53e7 commit 28b0da9

9 files changed

+12
-12
lines changed

tests/helpers/import-http-delay.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import assert from 'tjs:assert';
22

33
// This import should fail with a timeout error.
4-
import 'https://httpbin.org/delay/10';
4+
import 'https://postman-echo.com/delay/10';
55

66
assert.ok(false);

tests/test-fetch.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'tjs:assert';
22

33

44
async function basicFetch() {
5-
const r = await fetch('https://httpbin.org/get');
5+
const r = await fetch('https://postman-echo.com/get');
66
assert.eq(r.status, 200, 'status is 200');
77
};
88

@@ -13,15 +13,15 @@ async function abortFetch() {
1313
controller.abort();
1414
}, 500);
1515
try {
16-
await fetch('https://httpbin.org/delay/3', { signal });
16+
await fetch('https://postman-echo.com/delay/3', { signal });
1717
} catch (e) {
1818
assert.eq(e.name, 'AbortError', 'fetch was aborted');
1919
}
2020
};
2121

2222
async function fetchWithPostAndBody() {
2323
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', {
2525
method: 'POST',
2626
headers: {
2727
'Content-Type': 'application/json'
@@ -30,7 +30,7 @@ async function fetchWithPostAndBody() {
3030
});
3131
assert.eq(r.status, 200, 'status is 200');
3232
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');
3434
};
3535

3636

tests/test-xhr-abort.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'tjs:assert';
22

33

4-
const url = 'https://httpbin.org/delay/3';
4+
const url = 'https://postman-echo.com/delay/3';
55
const xhr = new XMLHttpRequest();
66
xhr.open('GET', url);
77
xhr.onabort = () => {

tests/test-xhr-basic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'tjs:assert';
22

33

4-
const url = 'https://httpbin.org/get';
4+
const url = 'https://postman-echo.com/get';
55
const xhr = new XMLHttpRequest();
66
xhr.open('GET', url);
77
xhr.onloadend = () => {

tests/test-xhr-body.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'tjs:assert';
22

33

44
const data = JSON.stringify({ foo: 'bar', bar: 'baz' });
5-
const url = 'https://httpbin.org/post';
5+
const url = 'https://postman-echo.com/post';
66
const xhr = new XMLHttpRequest();
77
xhr.open('POST', url);
88
xhr.responseType = 'json';

tests/test-xhr-et.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'tjs:assert';
22

33

4-
const url = 'https://httpbin.org/get';
4+
const url = 'https://postman-echo.com/get';
55
const xhr = new XMLHttpRequest();
66
xhr.open('GET', url);
77
xhr.addEventListener('loadend', () => {

tests/test-xhr-persistent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'tjs:assert';
22

33

4-
const url = 'https://httpbin.org/get';
4+
const url = 'https://postman-echo.com/get';
55
const xhr = new XMLHttpRequest();
66
xhr.open('GET', url, false);
77
xhr.send();

tests/test-xhr-progress.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'tjs:assert';
22

33

44
let lengthComputable = false, loaded, total;
5-
const url = 'https://httpbin.org/get';
5+
const url = 'https://postman-echo.com/get';
66
const xhrSync = new XMLHttpRequest();
77
xhrSync.open('GET', url, false);
88
xhrSync.onprogress = (evt) => {

tests/test-xhr-timeout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'tjs:assert';
22

33

4-
const url = 'https://httpbin.org/delay/3';
4+
const url = 'https://postman-echo.com/delay/3';
55
const xhr = new XMLHttpRequest();
66
xhr.open('GET', url);
77
xhr.timeout = 200;

0 commit comments

Comments
 (0)