Skip to content

Commit

Permalink
Test http.head signature
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Feb 28, 2022
1 parent 1ea597f commit d8ab553
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/modules/k6/http/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1136,10 +1136,11 @@ func TestRequestAndBatch(t *testing.T) {
})
t.Run("HEAD", func(t *testing.T) {
_, err := rt.RunString(sr(`
var res = http.head("HTTPBIN_URL/get?a=1&b=2");
var res = http.head("HTTPBIN_URL/get?a=1&b=2", {headers: {"X-We-Want-This": "value"}});
if (res.status != 200) { throw new Error("wrong status: " + res.status); }
if (res.body.length != 0) { throw new Error("HEAD responses shouldn't have a body"); }
if (!res.headers["Content-Length"]) { throw new Error("Missing or invalid Content-Length header!"); }
if (res.request.headers["X-We-Want-This"] != "value") { throw new Error("Missing or invalid X-We-Want-This header!"); }
`))
assert.NoError(t, err)
assertRequestMetricsEmitted(t, stats.GetBufferedSamples(samples), "HEAD", sr("HTTPBIN_URL/get?a=1&b=2"), "", 200, "")
Expand Down

0 comments on commit d8ab553

Please sign in to comment.