Skip to content

Commit 3f1bba0

Browse files
authored
Merge branch 'main' into fix/1247-node-target
2 parents 9407cf4 + 93b36f5 commit 3f1bba0

File tree

5 files changed

+26
-30
lines changed

5 files changed

+26
-30
lines changed

test/integration/axios.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const axios = require("axios");
22

33
(async () => {
4-
const { data } = await axios({
5-
url: "https://dog.ceo/api/breeds/image/random"
4+
const { status } = await axios({
5+
url: "https://example.vercel.sh"
66
});
7-
if (data.status !== "success") {
7+
if (status !== 200) {
88
throw new Error("Unexpected response: " + JSON.stringify(data));
99
}
1010
})();
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
const fetch = require("isomorphic-unfetch");
22

33
(async () => {
4-
const res = await fetch("https://dog.ceo/api/breeds/image/random");
5-
const data = await res.json()
6-
if (data.status !== "success") {
7-
throw new Error("Unexpected response: " + JSON.stringify(data));
8-
}
9-
})();
4+
const { status } = await fetch("https://example.vercel.sh");
5+
if (status !== 200) {
6+
throw new Error(`Unexpected status: ${status}`);
7+
}
8+
})();

test/integration/request-ts.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { get } from "request";
22

3-
const url = "https://dog.ceo/api/breeds/image/random";
4-
5-
export default () => {
6-
return new Promise((resolve, reject) => {
7-
get(url, { json: true }, (err, resp, body) => {
3+
(async () => {
4+
await new Promise((resolve, reject) => {
5+
get("https://example.vercel.sh", { json: false }, (err, res) => {
86
if (err) return reject(err);
9-
if (body.status != "success") {
10-
return reject(new Error("Bad api response: " + JSON.stringify(body)));
7+
if (res.statusCode !== 200) {
8+
return reject(new Error(`Bad status: ${res.statusCode}`));
119
}
12-
resolve('asdf');
10+
resolve(true);
1311
});
1412
});
15-
};
13+
})();

test/integration/request.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
const request = require("request");
2-
const url = "https://dog.ceo/api/breeds/image/random";
32

43
(async () => {
54
await new Promise((resolve, reject) => {
6-
request.get(url, { json: true }, (err, resp, body) => {
5+
request.get("https://example.vercel.sh", { json: false }, (err, res) => {
76
if (err) return reject(err);
8-
if (body.status != "success") {
9-
return reject(new Error("Bad api response: " + JSON.stringify(body)));
7+
if (res.statusCode !== 200) {
8+
return reject(new Error(`Bad status: ${res.statusCode}`));
109
}
11-
resolve();
10+
resolve(true);
1211
});
1312
});
14-
})();
13+
})();

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5242,9 +5242,9 @@ electron-to-chromium@^1.5.4:
52425242
integrity sha512-o37j1vZqCoEgBuWWXLHQgTN/KDKe7zwpiY5CPeq2RvUqOyJw9xnrULzZAEVQ5p4h+zjMk7hgtOoPdnLxr7m/jw==
52435243

52445244
elliptic@^6.5.3, elliptic@^6.5.5:
5245-
version "6.6.0"
5246-
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.6.0.tgz#5919ec723286c1edf28685aa89261d4761afa210"
5247-
integrity sha512-dpwoQcLc/2WLQvJvLRHKZ+f9FgOdjnq11rurqwekGQygGPsYSK29OMMD2WalatiqQ+XGFDglTNixpPfI+lpaAA==
5245+
version "6.6.1"
5246+
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.6.1.tgz#3b8ffb02670bf69e382c7f65bf524c97c5405c06"
5247+
integrity sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==
52485248
dependencies:
52495249
bn.js "^4.11.9"
52505250
brorand "^1.1.0"
@@ -9079,9 +9079,9 @@ koa-convert@^2.0.0:
90799079
koa-compose "^4.1.0"
90809080

90819081
koa@^2.14.2:
9082-
version "2.15.3"
9083-
resolved "https://registry.yarnpkg.com/koa/-/koa-2.15.3.tgz#062809266ee75ce0c75f6510a005b0e38f8c519a"
9084-
integrity sha512-j/8tY9j5t+GVMLeioLaxweJiKUayFhlGqNTzf2ZGwL0ZCQijd2RLHK0SLW5Tsko8YyyqCZC2cojIb0/s62qTAg==
9082+
version "2.15.4"
9083+
resolved "https://registry.yarnpkg.com/koa/-/koa-2.15.4.tgz#7000b3d8354558671adb1ba1b1c09bedb5f8da75"
9084+
integrity sha512-7fNBIdrU2PEgLljXoPWoyY4r1e+ToWCmzS/wwMPbUNs7X+5MMET1ObhJBlUkF5uZG9B6QhM2zS1TsH6adegkiQ==
90859085
dependencies:
90869086
accepts "^1.3.5"
90879087
cache-content-type "^1.0.0"

0 commit comments

Comments
 (0)