Skip to content

Commit

Permalink
Added test to hand abort handler
Browse files Browse the repository at this point in the history
  • Loading branch information
shadealabsamsft committed Oct 8, 2022
1 parent ad5c2cf commit 2932240
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions http3/server_test.go
Expand Up @@ -201,6 +201,19 @@ var _ = Describe("Server", func() {
Expect(hfs).To(HaveKeyWithValue(":status", []string{"200"}))
})

It("handles aborts", func() {
testErr := http.ErrAbortHandler
done := make(chan struct{})
unknownStr := mockquic.NewMockStream(mockCtrl)
s.UniStreamHijacker = func(st StreamType, _ quic.Connection, str quic.ReceiveStream, err error) bool {
defer close(done)
Expect(st).To(BeZero())
Expect(str).To(Equal(unknownStr))
Expect(err).To(MatchError(testErr))
return true
}
})

It("handles a panicking handler", func() {
s.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
panic("foobar")
Expand Down

0 comments on commit 2932240

Please sign in to comment.