提交 09791e51 编写于 作者: Z zhangfuzhi

新增caPath属性

Signed-off-by: Nzhangfuzhi <zhangfuzhi1@huawei.com>
上级 bf2e4f97
......@@ -100,7 +100,8 @@ export default function Http2Test() {
header: "content-type': 'application/json",
readTimeout: 6000,
connectTimeout: 6000,
priority: 100
priority: 100,
caPath: ''
}
var httpRequest = net_Http.createHttp();
httpRequest.request("https://www.zhihu.com", httpRequestOptions, (err, data) => {
......
......@@ -56,48 +56,25 @@ export default function HttpRequest2JsunitTest() {
it("SUB_Telephony_NetStack_HttpRequest2_Async_0100", 0, async function (done) {
let CaseName = "SUB_Telephony_NetStack_HttpRequest2_Async_0100";
let Address_Img = "https://img1.baidu.com/it/u=3010094603,1247181326&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500";
let HttpRequest = http.createHttp();
let httpRequest = http.createHttp();
try {
HttpRequest.on("dataReceive", dataReceive_on_callback);
HttpRequest.request2(Address_Img, httpRequestOptions).then(function () {
httpRequest.on("dataReceive", dataReceive_on_callback);
httpRequest.on("dataProgress", dataProgress_on_callback);
httpRequest.on("dataEnd", dataEnd_on_callback);
httpRequest.request2(Address_Img, httpRequestOptions, (err,data) => {
console.info(CaseName + " responseCode data : " + data);
console.log(CaseName + "NETSTACK request2 OK!");
HttpRequest.off("dataReceive");
httpRequest.off("dataReceive");
console.log("NETSTACK off dataReceive success!");
}).catch(function (err) {
console.log("NETSTACK request2 ERROR : error = " + JSON.stringify(err));
});
} catch (error) {
console.log("NETSTACK request2 ERROR : error = " + JSON.stringify(error));
}
try {
HttpRequest.on("dataProgress", dataProgress_on_callback);
HttpRequest.request2(Address_Img, httpRequestOptions).then(function () {
console.log(CaseName + "NETSTACK request2 OK!");
HttpRequest.off("dataProgress");
httpRequest.off("dataProgress");
console.log("NETSTACK off dataProgress success!");
}).catch(function (err) {
console.log("NETSTACK request2 ERROR : error = " + JSON.stringify(err));
});
} catch (error) {
console.log("NETSTACK request2 ERROR : error = " + JSON.stringify(error));
}
try {
HttpRequest.on("dataEnd", dataEnd_on_callback);
HttpRequest.request2(Address_Img, httpRequestOptions).then(function () {
console.log(CaseName + "NETSTACK request2 OK!");
HttpRequest.off("dataEnd");
done();
httpRequest.off("dataEnd");
console.log("NETSTACK off dataEnd success!");
}).catch(function (err) {
console.log("NETSTACK request2 ERROR : error = " + JSON.stringify(err));
expect(err).assertFalse();
httpRequest.destroy();
done();
});
})
} catch (error) {
console.log("NETSTACK request2 ERROR : error = " + JSON.stringify(error));
expect(error).assertFalse();
done();
console.log("NETSTACK request2 catch : error = " + JSON.stringify(error));
}
});
......@@ -110,13 +87,14 @@ export default function HttpRequest2JsunitTest() {
it("SUB_Telephony_NetStack_HttpRequest2_Async_0200", 0, async function (done) {
let CaseName = "SUB_Telephony_NetStack_HttpRequest2_Async_0200"
var httpRequest = http.createHttp();
httpRequest.request2(Address_Baidu, err => {
httpRequest.request2(Address_Baidu, (err,data) => {
if (err) {
console.log(CaseName + " request2 ERROR" + JSON.stringify(err));
expect().assertFail();
done();
}
console.log(CaseName + " request2 Finish");
httpRequest.destroy();
console.log(CaseName + " request2 Finish responseCode " + data);
done();
});
});
......@@ -129,8 +107,9 @@ export default function HttpRequest2JsunitTest() {
it("SUB_Telephony_NetStack_HttpRequest2_Promise_0100", 0, async function (done) {
let CaseName = "SUB_Telephony_NetStack_HttpRequest2_Promise_0100";
var httpRequest = http.createHttp();
httpRequest.request2(Address_Baidu, httpRequestOptions).then(function () {
console.log(CaseName + " request2 Finish ");
httpRequest.request2(Address_Baidu, httpRequestOptions).then(function (data) {
console.log(CaseName + " request2 Finish responseCode " + data);
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " error = " + JSON.stringify(err));
......@@ -147,8 +126,9 @@ export default function HttpRequest2JsunitTest() {
it("SUB_Telephony_NetStack_HttpRequest2_Promise_0200", 0, async function (done) {
let CaseName = "SUB_Telephony_NetStack_HttpRequest2_Promise_0200";
var httpRequest = http.createHttp();
httpRequest.request2(Address_Baidu).then(function () {
console.log(CaseName + " request2 Finish ");
httpRequest.request2(Address_Baidu).then(function (data) {
console.log(CaseName + " request2 Finish responseCode " + data);
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......@@ -172,6 +152,7 @@ export default function HttpRequest2JsunitTest() {
setTimeout(() => {
expect(dataReceive_status).assertEqual(true);
console.log(CaseName + " on dataReceive Finish ");
httpRequest.destroy();
done();
}, delayTime);
}).catch(function (err) {
......@@ -203,6 +184,7 @@ export default function HttpRequest2JsunitTest() {
expect(dataReceive_status).assertEqual(false);
}, delayTime);
console.log(CaseName + " off dataReceive Finish ");
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......@@ -232,6 +214,7 @@ export default function HttpRequest2JsunitTest() {
httpRequest.off("dataReceive");
}, delayTime);
console.log(CaseName + " off dataReceive Finish ");
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......@@ -260,6 +243,7 @@ export default function HttpRequest2JsunitTest() {
expect(dataProgress_status).assertEqual(true);
}, delayTime);
console.log(CaseName + " on dataProgress Finish ");
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......@@ -289,6 +273,7 @@ export default function HttpRequest2JsunitTest() {
expect(dataProgress_status).assertEqual(false);
}, delayTime);
console.log(CaseName + " off dataProgress Finish ");
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......@@ -318,6 +303,7 @@ export default function HttpRequest2JsunitTest() {
httpRequest.off("dataProgress");
}, delayTime);
console.log(CaseName + " off dataProgress Finish ");
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......@@ -347,6 +333,7 @@ export default function HttpRequest2JsunitTest() {
expect(dataEnd_status).assertEqual(true);
}, delayTime);
console.log(CaseName + " on dataEnd Finish ");
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......@@ -377,6 +364,7 @@ export default function HttpRequest2JsunitTest() {
expect(dataEnd_status).assertEqual(false);
}, delayTime);
console.log(CaseName + " off dataEnd Finish ");
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......@@ -406,6 +394,7 @@ export default function HttpRequest2JsunitTest() {
httpRequest.off("dataEnd");
}, delayTime);
console.log(CaseName + " off dataEnd Finish ");
httpRequest.destroy();
done();
}).catch(function (err) {
console.log(CaseName + " : error = " + JSON.stringify(err));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册