func TestS3H2ReqPhaseReturn(t *testing.T) {
	st := newServerTesterTLS([]string{"--npn-list=spdy/3.1", "--http2-bridge", "--mruby-file=" + testDir + "/req-return.rb"}, t, func(w http.ResponseWriter, r *http.Request) {
		t.Fatalf("request should not be forwarded")
	})
	defer st.Close()

	res, err := st.spdy(requestParam{
		name: "TestS3H2ReqPhaseReturn",
	})
	if err != nil {
		t.Fatalf("Error st.spdy() = %v", err)
	}

	if got, want := res.status, 404; got != want {
		t.Errorf("status = %v; want %v", got, want)
	}

	hdtests := []struct {
		k, v string
	}{
		{"content-length", "20"},
		{"from", "mruby"},
	}
	for _, tt := range hdtests {
		if got, want := res.header.Get(tt.k), tt.v; got != want {
			t.Errorf("%v = %v; want %v", tt.k, got, want)
		}
	}

	if got, want := string(res.body), "Hello World from req"; got != want {
		t.Errorf("body = %v; want %v", got, want)
	}
}
// TestS3H2ReqPhaseReturn tests mruby request phase hook returns
// custom response.

TestS3H2ReqPhaseReturn tests mruby request phase hook returns
custom response.
// TestS3H2ReqPhaseReturn tests mruby request phase hook returns // custom response .
func TestS3H2ReqPhaseReturn(t *testing.T) {
	st := newServerTesterTLS([]string{"--npn-list=spdy/3.1", "--http2-bridge", "--mruby-file=" + testDir + "/req-return.rb"}, t, func(w http.ResponseWriter, r *http.Request) {
		t.Fatalf("request should not be forwarded")
	})
	defer st.Close()
	res, err := st.spdy(requestParam{
		name: "TestS3H2ReqPhaseReturn",
	})
	if err != nil {
		t.Fatalf("Error st.spdy() = %v", err)
	}
	if got, want := res.status, 404; got != want {
		t.Errorf("status = %v; want %v", got, want)
	}
	hdtests := []struct {
		k, v string
	}{
		{"content-length", "20"},
		{"from", "mruby"},
	}
	for _, tt := range hdtests {
		if got, want := res.header.Get(tt.k), tt.v; got != want {
			t.Errorf("%v = %v; want %v", tt.k, got, want)
		}
	}
	if got, want := string(res.body), "Hello World from req"; got != want {
		t.Errorf("body = %v; want %v", got, want)
	}
}
func TestS3H2ReqPhaseReturn ( t * testing . T ) { st := newServerTesterTLS ( [ ] string { " " , " " , " " + testDir + " " } , t , func ( w http . ResponseWriter , r * http . Request ) { t . Fatalf ( " " ) } ) defer st . Close ( ) res , err := st . spdy ( requestParam { name : " " , } ) if err != nil { t . Fatalf ( " " , err ) } if got , want := res . status , 404 ; got != want { t . Errorf ( " " , got , want ) } hdtests := [ ] struct { k , v string } { { " " , " " } , { " " , " " } , } for _ , tt := range hdtests { if got , want := res . header . Get ( tt . k ) , tt . v ; got != want { t . Errorf ( " " , tt . k , got , want ) } } if got , want := string ( res . body ) , " " ; got != want { t . Errorf ( " " , got , want ) } }
TestS3H2ReqPhaseReturn tests mruby request phase hook returns
custom response.
TestS3H2ReqPhaseReturn tests mruby request phase hook returns custom response .