未验证 提交 6eefd615 编写于 作者: O openharmony_ci 提交者: Gitee

!8426 新增caPath属性

Merge pull request !8426 from zhangfuzhi/master
......@@ -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,46 +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));
console.log("NETSTACK request2 catch : error = " + JSON.stringify(error));
expect(error).assertFalse();
done();
}
......@@ -110,13 +89,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 +109,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 +128,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 +154,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 +186,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 +216,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 +245,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 +275,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 +305,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 +335,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 +366,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 +396,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.
先完成此消息的编辑!
想要评论请 注册