Skip to content
This repository was archived by the owner on Jul 12, 2025. It is now read-only.

Commit 0f50e29

Browse files
committed
Make http test for different method more robust
1 parent 041cdf2 commit 0f50e29

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

vm/http_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ func TestHTTPRequest(t *testing.T) {
3636
require "net/http"
3737
3838
res = Net::HTTP.head("http://127.0.0.1:3000/index")
39-
res["Content-Length"]
40-
`, "16"},
39+
res["X-Request-Method"]
40+
`, "HEAD"},
4141
{`
4242
require "net/http"
4343
4444
res = Net::HTTP.delete("http://127.0.0.1:3000/index")
45-
res["Content-Length"]
46-
`, "18"},
45+
res["X-Request-Method"]
46+
`, "DELETE"},
4747
{`
4848
require "net/http"
4949
5050
res = Net::HTTP.options("http://127.0.0.1:3000/index")
51-
res["Content-Length"]
52-
`, "19"},
51+
res["X-Request-Method"]
52+
`, "OPTIONS"},
5353
}
5454

5555
//block until server is ready
@@ -171,6 +171,7 @@ func startTestServer(c chan bool) {
171171
m := http.NewServeMux()
172172

173173
m.HandleFunc("/index", func(w http.ResponseWriter, r *http.Request) {
174+
w.Header().Set("X-Request-Method", r.Method)
174175
w.WriteHeader(http.StatusOK)
175176

176177
if r.Method == http.MethodPost {

0 commit comments

Comments
 (0)