diff --git a/CHANGELOG.md b/CHANGELOG.md index a26a88a..846ca7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.1] - 2026-02-20 +### Changed +- Increased default maximum request body size to 16MB + ## [0.5.0] - 2026-02-11 ### Added @@ -78,6 +82,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial release +[0.5.1]: https://github.com/gooddata/gooddata-goodmock/compare/v0.5.0...v0.5.1 [0.5.0]: https://github.com/gooddata/gooddata-goodmock/compare/v0.4.0...v0.5.0 [0.4.0]: https://github.com/gooddata/gooddata-goodmock/compare/v0.3.2...v0.4.0 [0.3.2]: https://github.com/gooddata/gooddata-goodmock/compare/v0.3.1...v0.3.2 diff --git a/VERSION b/VERSION index 79a2734..5d4294b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.0 \ No newline at end of file +0.5.1 \ No newline at end of file diff --git a/internal/pureproxy/pureproxy.go b/internal/pureproxy/pureproxy.go index 979dc47..d616d5b 100644 --- a/internal/pureproxy/pureproxy.go +++ b/internal/pureproxy/pureproxy.go @@ -89,6 +89,7 @@ func forwardAndRespond(ps *ProxyServer, ctx *fasthttp.RequestCtx) { func RunProxy() { port := common.GetPort() + const maxRequestBodySize = 16 * 1024 * 1024 upstream := os.Getenv("PROXY_HOST") if upstream == "" { @@ -113,10 +114,18 @@ func RunProxy() { fmt.Printf("| Port: %-69d|\n", port) fmt.Printf("| Upstream: %-66s|\n", upstream) fmt.Printf("| Verbose: %-66v|\n", verbose) + fmt.Printf("| Max Request Body: %-57s|\n", fmt.Sprintf("%d bytes", maxRequestBodySize)) fmt.Println("| |") fmt.Println("└──────────────────────────────────────────────────────────────────────────────┘") - log.Fatal(fasthttp.ListenAndServe(addr, func(ctx *fasthttp.RequestCtx) { - handleProxyRequest(ps, ctx) - })) + httpServer := &fasthttp.Server{ + Handler: func(ctx *fasthttp.RequestCtx) { handleProxyRequest(ps, ctx) }, + MaxRequestBodySize: maxRequestBodySize, + ErrorHandler: func(ctx *fasthttp.RequestCtx, err error) { + ctx.SetStatusCode(fasthttp.StatusBadRequest) + ctx.SetBodyString(err.Error()) + }, + } + + log.Fatal(httpServer.ListenAndServe(addr)) } diff --git a/internal/record/record.go b/internal/record/record.go index 857d7ac..6358ef0 100644 --- a/internal/record/record.go +++ b/internal/record/record.go @@ -610,6 +610,7 @@ func compileURLMatcher(pattern string) func(string) bool { func RunRecord() { port := common.GetPort() + const maxRequestBodySize = 16 * 1024 * 1024 upstream := os.Getenv("PROXY_HOST") if upstream == "" { @@ -637,10 +638,18 @@ func RunRecord() { fmt.Printf("| Port: %-69d|\n", port) fmt.Printf("| Upstream: %-66s|\n", upstream) fmt.Printf("| Verbose: %-66v|\n", verbose) + fmt.Printf("| Max Request Body: %-57s|\n", fmt.Sprintf("%d bytes", maxRequestBodySize)) fmt.Println("| |") fmt.Println("└──────────────────────────────────────────────────────────────────────────────┘") - log.Fatal(fasthttp.ListenAndServe(addr, func(ctx *fasthttp.RequestCtx) { - handleRecordRequest(rs, ctx) - })) + httpServer := &fasthttp.Server{ + Handler: func(ctx *fasthttp.RequestCtx) { handleRecordRequest(rs, ctx) }, + MaxRequestBodySize: maxRequestBodySize, + ErrorHandler: func(ctx *fasthttp.RequestCtx, err error) { + ctx.SetStatusCode(fasthttp.StatusBadRequest) + ctx.SetBodyString(err.Error()) + }, + } + + log.Fatal(httpServer.ListenAndServe(addr)) } diff --git a/main.go b/main.go index 5c99294..765e86d 100644 --- a/main.go +++ b/main.go @@ -38,6 +38,7 @@ func main() { func runReplay() { port := common.GetPort() + const maxRequestBodySize = 16 * 1024 * 1024 proxyHost := os.Getenv("PROXY_HOST") if proxyHost == "" { @@ -90,10 +91,18 @@ func runReplay() { fmt.Printf("| Mode: %-69s|\n", "replay") fmt.Printf("| Port: %-69d|\n", port) fmt.Printf("| Verbose: %-66v|\n", verbose) + fmt.Printf("| Max Request Body: %-57s|\n", fmt.Sprintf("%d bytes", maxRequestBodySize)) fmt.Println("| |") fmt.Println("└──────────────────────────────────────────────────────────────────────────────┘") - log.Fatal(fasthttp.ListenAndServe(addr, func(ctx *fasthttp.RequestCtx) { - server.HandleRequest(s, ctx) - })) + httpServer := &fasthttp.Server{ + Handler: func(ctx *fasthttp.RequestCtx) { server.HandleRequest(s, ctx) }, + MaxRequestBodySize: maxRequestBodySize, + ErrorHandler: func(ctx *fasthttp.RequestCtx, err error) { + ctx.SetStatusCode(fasthttp.StatusBadRequest) + ctx.SetBodyString(err.Error()) + }, + } + + log.Fatal(httpServer.ListenAndServe(addr)) }