fix(core): update
This commit is contained in:
parent
0d4e8631dc
commit
49772002f9
1975
package-lock.json
generated
1975
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.0.22",
|
||||||
"@gitzone/tstest": "^1.0.15",
|
"@gitzone/tstest": "^1.0.15",
|
||||||
|
"@pushrocks/smartexpress": "^2.0.4",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.0.7",
|
||||||
"@types/node": "^10.11.7",
|
"@types/node": "^10.11.7",
|
||||||
"tslint": "^5.11.0",
|
"tslint": "^5.11.0",
|
||||||
|
26
test/test.ts
26
test/test.ts
@ -1,8 +1,28 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as webrequest from '../ts/index'
|
import * as webrequest from '../ts/index';
|
||||||
|
|
||||||
tap.test('first test', async () => {
|
// test dependencies
|
||||||
console.log(webrequest.standardExport)
|
import * as smartexpress from '@pushrocks/smartexpress';
|
||||||
|
|
||||||
|
let testServer: smartexpress.Server;
|
||||||
|
|
||||||
|
tap.test('setup test server', async () => {
|
||||||
|
testServer = new smartexpress.Server({
|
||||||
|
cors: false,
|
||||||
|
forceSsl: false,
|
||||||
|
port: 1234
|
||||||
|
});
|
||||||
|
|
||||||
|
testServer.addRoute('/apiroute1', new smartexpress.Handler("GET", (req, res) => {
|
||||||
|
res.status(429);
|
||||||
|
res.end();
|
||||||
|
}));
|
||||||
|
|
||||||
|
testServer
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('first test', async (tools) => {
|
||||||
|
console.log(webrequest)
|
||||||
})
|
})
|
||||||
|
|
||||||
tap.start()
|
tap.start()
|
||||||
|
@ -70,7 +70,7 @@ export class WebRequest {
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (response.status >= 200 && response.status < 200) {
|
if (response.status >= 200 && response.status < 300) {
|
||||||
return JSON.parse(await response.text());
|
return JSON.parse(await response.text());
|
||||||
} else if (response.status === 429) {
|
} else if (response.status === 429) {
|
||||||
await doHistoryCheck('429');
|
await doHistoryCheck('429');
|
||||||
|
Loading…
Reference in New Issue
Block a user