From 355a8e297b531c30cbfa9ef0647cf5f45c00d3ac Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Wed, 6 Apr 2022 11:25:06 +0300 Subject: [PATCH] Add test for https://github.com/grafana/k6/issues/2480 --- js/modules/k6/http/file_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/js/modules/k6/http/file_test.go b/js/modules/k6/http/file_test.go index ba22524e0263..a771562a4a75 100644 --- a/js/modules/k6/http/file_test.go +++ b/js/modules/k6/http/file_test.go @@ -81,3 +81,16 @@ func TestHTTPFile(t *testing.T) { }) } } + +func TestHTTPFileDataInRequest(t *testing.T) { + t.Parallel() + + tb, _, _, rt, _ := newRuntime(t) //nolint:dogsled + _, err := rt.RunString(tb.Replacer.Replace(` + let f = http.file("something"); + let res = http.request("POST", "HTTPBIN_URL/post", f.data); + if (res.status != 200) { + throw new Error("Unexpected status " + res.status) + }`)) + require.NoError(t, err) +}