Bug 1783567 - test case, r=necko-reviewers,dragana

Differential Revision: https://phabricator.services.mozilla.com/D153940
This commit is contained in:
Kershaw Chang 2022-08-08 12:08:25 +00:00
Родитель 8104b43b79
Коммит ca7f73fc07
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -684,6 +684,12 @@ function test_http2_post() {
do_post(posts[0], chan, listener, "POST");
}
function test_http2_empty_post() {
var chan = makeChan("https://localhost:" + serverPort + "/post");
var listener = new Http2PostListener("0");
do_post("", chan, listener, "POST");
}
// Make sure we can do a simple PATCH
function test_http2_patch() {
var chan = makeChan("https://localhost:" + serverPort + "/patch");
@ -1319,6 +1325,7 @@ var tests = [
test_http2_big,
test_http2_huge_suspended,
test_http2_post,
test_http2_empty_post,
test_http2_patch,
test_http2_pushapi_1,
test_http2_continuations,

Просмотреть файл

@ -719,11 +719,13 @@ function handleRequest(req, res) {
}
var post_hash = crypto.createHash("md5");
var received_data = false;
req.on("data", function receivePostData(chunk) {
received_data = true;
post_hash.update(chunk.toString());
});
req.on("end", function finishPost() {
let md5 = post_hash.digest("hex");
let md5 = received_data ? post_hash.digest("hex") : "0";
res.setHeader("X-Calculated-MD5", md5);
res.writeHead(200);
res.end(content);