mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-06 02:48:48 +03:00
proxy: fix TestReverseProxy failure on go tip (#1360)
Because of this commit(6e36811c37399d60cbce587b7c48e611009c5aec) on go tip, it will probe the request's body to determine whether to use chunked transfer encoding which trailers depend on it. So we just offer a non empty body to make trailers work. fix issue #1359 Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
parent
6bac558c98
commit
ecf852ea43
1 changed files with 2 additions and 1 deletions
|
@ -78,7 +78,7 @@ func TestReverseProxy(t *testing.T) {
|
|||
}
|
||||
|
||||
// create request and response recorder
|
||||
r := httptest.NewRequest("GET", "/", nil)
|
||||
r := httptest.NewRequest("GET", "/", strings.NewReader("test"))
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
r.ContentLength = -1 // force chunked encoding (required for trailers)
|
||||
|
@ -97,6 +97,7 @@ func TestReverseProxy(t *testing.T) {
|
|||
verifyHeaders(res.Header, res.Trailer)
|
||||
|
||||
// Make sure {upstream} placeholder is set
|
||||
r.Body = ioutil.NopCloser(strings.NewReader("test"))
|
||||
rr := httpserver.NewResponseRecorder(httptest.NewRecorder())
|
||||
rr.Replacer = httpserver.NewReplacer(r, rr, "-")
|
||||
|
||||
|
|
Loading…
Reference in a new issue