This commit is contained in:
xiaofeng.mxf
2019-02-26 23:26:50 +08:00
parent ce1327205c
commit 9682926e67
6 changed files with 57 additions and 18 deletions

View File

@@ -4,9 +4,10 @@
*/
const ProxyServerUtil = require('../util/ProxyServerUtil.js');
const { proxyGet } = require('../util/HttpUtil.js');
const { printLog } = require('../util/CommonUtil.js');
const domain_not_exists = 'not_exist.not_exist_anyproxy_io_domain.com';
let errorInRule = null;
const ruleNotDealError = {
*onError(requestDetail, error) {
@@ -62,7 +63,7 @@ function testWrapper(protocol) {
});
it('Should get a request error', done => {
const url = protocol + '://not_exist_url.anyproxy.io';
const url = protocol + `://${domain_not_exists}`;
proxyGet(url)
.then(proxyRes => {
expect(proxyRes.statusCode).toEqual(500);
@@ -99,7 +100,7 @@ function testWrapper(protocol) {
});
it('Should get a request error', done => {
const url = protocol + '://not_exist_url.anyproxy.io';
const url = protocol + `://${domain_not_exists}`;
proxyGet(url)
.then(proxyRes => {
expect(proxyRes.statusCode).toEqual(200);
@@ -140,7 +141,7 @@ function testHttpsConnect() {
});
it('Should get a request error', done => {
const url = 'https://not_exist_url.anyproxy.io';
const url = `https://${domain_not_exists}`;
proxyGet(url)
.then(proxyRes => {
done.fail('should throw an error when requesting');