Codebase list golang-github-go-kit-kit / 0f7f937
Declare httprp server test values as function-scoped constants Scott Kidder 8 years ago
1 changed file(s) with 7 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
3939 }
4040
4141 func TestServerHappyPathSingleServerWithServerOptions(t *testing.T) {
42 const (
43 headerKey = "X-TEST-HEADER"
44 headerVal = "go-kit-proxy"
45 )
46
4247 originServer := httptest.NewServer(
4348 http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
44 if want, have := "go-kit-proxy", r.Header.Get("X-TEST-HEADER"); want != have {
49 if want, have := headerVal, r.Header.Get(headerKey); want != have {
4550 t.Errorf("want %d, have %d", want, have)
4651 }
4752
5560 context.Background(),
5661 originURL,
5762 httptransport.ServerBefore(func(ctx context.Context, r *http.Request) context.Context {
58 r.Header.Add("X-TEST-HEADER", "go-kit-proxy")
63 r.Header.Add(headerKey, headerVal)
5964 return ctx
6065 }),
6166 )