MCPcopy Index your code
hub / github.com/codegangsta/gin / Test_Proxying_Build_Errors

Function Test_Proxying_Build_Errors

lib/proxy_test.go:93–114  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func Test_Proxying_Build_Errors(t *testing.T) {
94 builder := NewMockBuilder()
95 builder.MockErrors = "Foo bar here are some errors"
96 runner := NewMockRunner()
97 proxy := gin.NewProxy(builder, runner)
98
99 config := &gin.Config{
100 Port: 5679,
101 ProxyTo: "http://localhost:3000",
102 }
103
104 err := proxy.Run(config)
105 defer proxy.Close()
106 expect(t, err, nil)
107
108 res, err := http.Get("http://localhost:5679")
109 expect(t, err, nil)
110 expect(t, res == nil, false)
111 errors, err := ioutil.ReadAll(res.Body)
112 res.Body.Close()
113 expect(t, fmt.Sprintf("%s", errors), "Foo bar here are some errors")
114}

Callers

nothing calls this directly

Calls 5

RunMethod · 0.95
CloseMethod · 0.95
NewMockBuilderFunction · 0.85
NewMockRunnerFunction · 0.85
expectFunction · 0.85

Tested by

no test coverage detected