reject requests with an invalid request method

This commit is contained in:
Marten Seemann
2016-12-22 14:23:32 +07:00
parent feec325083
commit 1854279bb5
2 changed files with 36 additions and 0 deletions

View File

@@ -105,5 +105,13 @@ var _ = Describe("RoundTripper", func() {
_, err := rt.RoundTrip(req1)
Expect(err.Error()).To(ContainSubstring("quic: invalid http header field value"))
})
It("rejects requests with an invalid request method", func() {
req1.Method = "foobär"
req1.Body = &mockBody{}
_, err := rt.RoundTrip(req1)
Expect(err).To(MatchError("quic: invalid method \"foobär\""))
Expect(req1.Body.(*mockBody).closed).To(BeTrue())
})
})
})