diff --git a/proxy_test.go b/proxy_test.go index bc97639d..6015ee7b 100644 --- a/proxy_test.go +++ b/proxy_test.go @@ -4,6 +4,7 @@ import ( "bytes" "crypto/tls" "fmt" + "github.com/contentsquare/chproxy/cache" "io" "math/rand" "net" @@ -249,6 +250,19 @@ func TestReverseProxy_ServeHTTP1(t *testing.T) { return makeRequest(p) }, }, + { + cfg: goodCfg, + name: "max payload size limit", + expResponse: okResponse, + expStatusCode: http.StatusOK, + f: func(p *reverseProxy) *http.Response { + p.caches["max_payload_size"] = &cache.AsyncCache{ + MaxPayloadSize: 8 * 1024 * 1024, + } + p.users["default"].cache = p.caches["max_payload_size"] + return makeRequest(p) + }, + }, { cfg: goodCfg, name: "queue overflow for user", @@ -397,6 +411,21 @@ func TestReverseProxy_ServeHTTP1(t *testing.T) { return makeCustomRequest(p, req) }, }, + { + cfg: authCfg, + name: "post request max payload size", + expResponse: okResponse, + expStatusCode: http.StatusOK, + f: func(p *reverseProxy) *http.Response { + uri := fmt.Sprintf("%s?user=foo&password=bar", fakeServer.URL) + req := httptest.NewRequest("POST", uri, nil) + p.caches["max_payload_size"] = &cache.AsyncCache{ + MaxPayloadSize: 8 * 1024 * 1024, + } + p.users["foo"].cache = p.caches["max_payload_size"] + return makeCustomRequest(p, req) + }, + }, } for _, tc := range testCases {