mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
Vendor dependencies
This commit is contained in:
committed by
Zlatko Čalušić
parent
2f0a16d8b7
commit
6054876201
32
vendor/goji.io/dispatch_test.go
generated
vendored
Normal file
32
vendor/goji.io/dispatch_test.go
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
package goji
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"goji.io/internal"
|
||||
)
|
||||
|
||||
func TestDispatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var d dispatch
|
||||
|
||||
w, r := wr()
|
||||
d.ServeHTTP(w, r)
|
||||
if w.Code != 404 {
|
||||
t.Errorf("status: expected %d, got %d", 404, w.Code)
|
||||
}
|
||||
|
||||
w, r = wr()
|
||||
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(123)
|
||||
})
|
||||
ctx := context.WithValue(context.Background(), internal.Handler, h)
|
||||
r = r.WithContext(ctx)
|
||||
d.ServeHTTP(w, r)
|
||||
if w.Code != 123 {
|
||||
t.Errorf("status: expected %d, got %d", 123, w.Code)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user