From d73cdddabb2bb18bdd08314b9d1e506bdc48a169 Mon Sep 17 00:00:00 2001 From: Bowen Date: Sun, 24 May 2026 12:52:31 +0800 Subject: [PATCH 1/4] test: add timeout isolation regression coverage Pin goravel/gin and goravel/fiber to the timeout fix snapshots so the example app can verify 408 timeout responses and stale-response isolation under both drivers. --- go.mod | 33 +++++++++--------- go.sum | 70 ++++++++++++++++++++------------------ routes/api.go | 18 ++++++++++ tests/feature/http_test.go | 25 ++++++++++++-- 4 files changed, 94 insertions(+), 52 deletions(-) diff --git a/go.mod b/go.mod index 546f23d..ed6c6db 100644 --- a/go.mod +++ b/go.mod @@ -9,9 +9,9 @@ require ( github.com/gofiber/template/html/v2 v2.1.3 github.com/goravel/cos v1.17.1-0.20260323021954-3ddc163693ee github.com/goravel/example-proto v0.0.1 - github.com/goravel/fiber v1.17.1-0.20260319150449-0a18b9c6e22b + github.com/goravel/fiber v1.17.1-0.20260524040519-047523ffa71c github.com/goravel/framework v1.17.2 - github.com/goravel/gin v1.17.1-0.20260319150458-6d1543fdf889 + github.com/goravel/gin v1.17.1-0.20260524040513-e1372c698db3 github.com/goravel/minio v1.17.1-0.20260406054609-93d9a56045ac github.com/goravel/mysql v1.17.2-0.20260328140940-c52993f25694 github.com/goravel/oss v1.17.1-0.20260316041853-7cb11e498cb9 @@ -45,7 +45,7 @@ require ( github.com/Masterminds/squirrel v1.5.4 // indirect github.com/agnivade/levenshtein v1.1.1 // indirect github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible // indirect - github.com/andybalholm/brotli v1.2.0 // indirect + github.com/andybalholm/brotli v1.2.1 // indirect github.com/atotto/clipboard v0.1.4 // indirect github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect @@ -92,6 +92,7 @@ require ( github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/gabriel-vasile/mimetype v1.4.13 // indirect github.com/gin-contrib/sse v1.1.0 // indirect + github.com/gin-contrib/timeout v1.2.1 // indirect github.com/go-ini/ini v1.67.0 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -106,13 +107,13 @@ require ( github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/goccy/go-json v0.10.5 // indirect github.com/goccy/go-yaml v1.19.2 // indirect - github.com/gofiber/fiber/v3 v3.1.0 // indirect - github.com/gofiber/schema v1.7.0 // indirect + github.com/gofiber/fiber/v3 v3.2.0 // indirect + github.com/gofiber/schema v1.7.1 // indirect github.com/gofiber/template v1.8.3 // indirect - github.com/gofiber/template/html/v3 v3.0.2 // indirect + github.com/gofiber/template/html/v3 v3.0.4 // indirect github.com/gofiber/template/v2 v2.1.0 // indirect github.com/gofiber/utils v1.1.0 // indirect - github.com/gofiber/utils/v2 v2.0.2 // indirect + github.com/gofiber/utils/v2 v2.0.5 // indirect github.com/goforj/godump v1.9.1 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect @@ -132,7 +133,7 @@ require ( github.com/jmoiron/sqlx v1.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.18.4 // indirect + github.com/klauspost/compress v1.18.6 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/klauspost/crc32 v1.3.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect @@ -142,7 +143,7 @@ require ( github.com/lucasb-eyer/go-colorful v1.3.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.14 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-isatty v0.0.21 // indirect github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.22 // indirect github.com/microsoft/go-mssqldb v1.9.1 // indirect @@ -185,14 +186,14 @@ require ( github.com/swaggo/files/v2 v2.0.0 // indirect github.com/tencentyun/cos-go-sdk-v5 v0.7.73 // indirect github.com/tetratelabs/wazero v1.9.0 // indirect - github.com/tinylib/msgp v1.6.3 // indirect + github.com/tinylib/msgp v1.6.4 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/ugorji/go/codec v1.3.1 // indirect github.com/unrolled/secure v1.17.0 // indirect github.com/urfave/cli/v3 v3.8.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.69.0 // indirect + github.com/valyala/fasthttp v1.71.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect go.mongodb.org/mongo-driver/v2 v2.5.0 // indirect @@ -219,14 +220,14 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/arch v0.22.0 // indirect - golang.org/x/crypto v0.49.0 // indirect + golang.org/x/crypto v0.50.0 // indirect golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect golang.org/x/mod v0.34.0 // indirect - golang.org/x/net v0.52.0 // indirect + golang.org/x/net v0.53.0 // indirect golang.org/x/sync v0.20.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/term v0.41.0 // indirect - golang.org/x/text v0.35.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/term v0.42.0 // indirect + golang.org/x/text v0.36.0 // indirect golang.org/x/time v0.12.0 // indirect golang.org/x/tools v0.43.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect diff --git a/go.sum b/go.sum index e61e5a0..ec93a1c 100644 --- a/go.sum +++ b/go.sum @@ -64,8 +64,8 @@ github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible h1:8psS8a+wKfiLt1iVDX79F github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ= -github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= +github.com/andybalholm/brotli v1.2.1 h1:R+f5xP285VArJDRgowrfb9DqL18yVK0gKAW/F+eTWro= +github.com/andybalholm/brotli v1.2.1/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= @@ -192,12 +192,14 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= -github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/fxamacker/cbor/v2 v2.9.2 h1:X4Ksno9+x3cz0TZv69ec1hxP/+tymuR8PXQJyDwfh78= +github.com/fxamacker/cbor/v2 v2.9.2/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM= github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= +github.com/gin-contrib/timeout v1.2.1 h1:vw+1K+rDo1M86G00A1RdQZDP9JJDcJjYj6+9ZVowjlk= +github.com/gin-contrib/timeout v1.2.1/go.mod h1:sUImmGGy/39JoCfTRnouXWJRVuUvR0DGcdRorXn7VdE= github.com/gin-gonic/gin v1.12.0 h1:b3YAbrZtnf8N//yjKeU2+MQsh2mY5htkZidOM7O0wG8= github.com/gin-gonic/gin v1.12.0/go.mod h1:VxccKfsSllpKshkBWgVgRniFFAzFb9csfngsqANjnLc= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -235,22 +237,22 @@ github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/gofiber/fiber/v2 v2.52.12 h1:0LdToKclcPOj8PktUdIKo9BUohjjwfnQl42Dhw8/WUw= github.com/gofiber/fiber/v2 v2.52.12/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= -github.com/gofiber/fiber/v3 v3.1.0 h1:1p4I820pIa+FGxfwWuQZ5rAyX0WlGZbGT6Hnuxt6hKY= -github.com/gofiber/fiber/v3 v3.1.0/go.mod h1:n2nYQovvL9z3Too/FGOfgtERjW3GQcAUqgfoezGBZdU= -github.com/gofiber/schema v1.7.0 h1:yNM+FNRZjyYEli9Ey0AXRBrAY9jTnb+kmGs3lJGPvKg= -github.com/gofiber/schema v1.7.0/go.mod h1:A/X5Ffyru4p9eBdp99qu+nzviHzQiZ7odLT+TwxWhbk= +github.com/gofiber/fiber/v3 v3.2.0 h1:g9+09D320foINPpCnR3ibQ5oBEFHjAWRRfDG1te54u8= +github.com/gofiber/fiber/v3 v3.2.0/go.mod h1:FHOsc2Db7HhHpsE62QAaJlXVV1pNkbZEptZ4jtti7m4= +github.com/gofiber/schema v1.7.1 h1:oSJBKdgP8JeIME4TQSAqlNKTU2iBB+2RNmKi8Nsc+TI= +github.com/gofiber/schema v1.7.1/go.mod h1:A/X5Ffyru4p9eBdp99qu+nzviHzQiZ7odLT+TwxWhbk= github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc= github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8= github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6dFLp8ea+o= github.com/gofiber/template/html/v2 v2.1.3/go.mod h1:U5Fxgc5KpyujU9OqKzy6Kn6Qup6Tm7zdsISR+VpnHRE= -github.com/gofiber/template/html/v3 v3.0.2 h1:/Fh8UcEsB4uhf1QWNbYaAOwXxSORebJ2zXkb5tgG/TI= -github.com/gofiber/template/html/v3 v3.0.2/go.mod h1:9phaCZLPZq2nFNTZj9zrmR8FSA8ydtBQFL9SEsr4jqI= +github.com/gofiber/template/html/v3 v3.0.4 h1:0wNAQtC6QepN9YBDoZCq+vdMxsCwSafxWF/8/Zm0wxk= +github.com/gofiber/template/html/v3 v3.0.4/go.mod h1:Fw2JD0ALJQBsjwNc4crVtIwBUw5cbJngjW5J+mpKFXQ= github.com/gofiber/template/v2 v2.1.0 h1:vrLY6uEW2HdioJm6J5FGUpYZuapVQhHciNz21XQjR/4= github.com/gofiber/template/v2 v2.1.0/go.mod h1:ohgpR/Ng90nJbK+IyNzrgR/XpnBNt862/oTF5G7SAmE= github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM= github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0= -github.com/gofiber/utils/v2 v2.0.2 h1:ShRRssz0F3AhTlAQcuEj54OEDtWF7+HJDwEi/aa6QLI= -github.com/gofiber/utils/v2 v2.0.2/go.mod h1:+9Ub4NqQ+IaJoTliq5LfdmOJAA/Hzwf4pXOxOa3RrJ0= +github.com/gofiber/utils/v2 v2.0.5 h1:IMXoI2A5Dao/aMMBURTNxnhbtQO4kUwUFOgcwFSIjLU= +github.com/gofiber/utils/v2 v2.0.5/go.mod h1:FwwopfzwAQsoXLCHhOT24eH2jQfBgrrra9S5p0+luxg= github.com/goforj/godump v1.9.1 h1:9OGpb978Ytz3B59d5Yi2PzRYYLid6UkmhYDIDNiF15Y= github.com/goforj/godump v1.9.1/go.mod h1:JsuL6AEZfKIU+iR5ewL6iQ2fIuhvLtPmJDH47M9Ptrc= github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= @@ -289,12 +291,12 @@ github.com/goravel/cos v1.17.1-0.20260323021954-3ddc163693ee h1:q6hWsmKE1xuqpi7/ github.com/goravel/cos v1.17.1-0.20260323021954-3ddc163693ee/go.mod h1:yis0L0BSc4MiYiOXumba/F6LqWPyChdV7uOQwFX+bTk= github.com/goravel/example-proto v0.0.1 h1:ZxETeKREQWjuJ49bX/Hqj1NLR5Vyj489Ks6dRxYeQsk= github.com/goravel/example-proto v0.0.1/go.mod h1:I8IPsHr4Ndf7KxmdsRpBR2LQ0Geo48+pjv9IIWf3mZg= -github.com/goravel/fiber v1.17.1-0.20260319150449-0a18b9c6e22b h1:peMAbfUTyQJCtA4wABmOowETE8N5v6i0GEy3vqVWeCg= -github.com/goravel/fiber v1.17.1-0.20260319150449-0a18b9c6e22b/go.mod h1:vVfU2LnxhCXOE1QH9U0/bFPBfIvbqCD3xyDkSm4wmVM= +github.com/goravel/fiber v1.17.1-0.20260524040519-047523ffa71c h1:OV2obbs8BQRHU8n0oT2M//eruXRzljIaVlH1SBpjtv0= +github.com/goravel/fiber v1.17.1-0.20260524040519-047523ffa71c/go.mod h1:JkUiNH4SDXncjfMn70YqfVxJGpR7WJu64T4jyTYe8RI= github.com/goravel/framework v1.17.2-0.20260408110243-4838a69e4bdd h1:/SosPdp3n/B59wiRzRUjAkscQtoXg4emy9O3hspdJ1E= github.com/goravel/framework v1.17.2-0.20260408110243-4838a69e4bdd/go.mod h1:j75T9n1majM+KYFJPP8xEeZZBrQn4aFVJQc3sl5ZBfQ= -github.com/goravel/gin v1.17.1-0.20260319150458-6d1543fdf889 h1:P1wUP46zVOoD3wXFrydvoBs3q8SfJO7Gk7TU6emKNZE= -github.com/goravel/gin v1.17.1-0.20260319150458-6d1543fdf889/go.mod h1:GsI8Ep1tfePcLHSx0vVtj+k3PLwpn/rUs4tKDFaH7b0= +github.com/goravel/gin v1.17.1-0.20260524040513-e1372c698db3 h1:Zy4XPyzWYUKOXQFlUnLtNXY39reh+LCucTAc40TykaQ= +github.com/goravel/gin v1.17.1-0.20260524040513-e1372c698db3/go.mod h1:92/izGQ6edpy5p314VjaiDy4NrD37k6bvegGCnTzlEo= github.com/goravel/minio v1.17.1-0.20260406054609-93d9a56045ac h1:umDvd9hciZVHvlmRVAioXpT+kUojwc2MO30wcnshHh0= github.com/goravel/minio v1.17.1-0.20260406054609-93d9a56045ac/go.mod h1:kcnWmIaUPCNU4cGNY3AvW9kYToTPGdhQk232k1o+lTg= github.com/goravel/mysql v1.17.2-0.20260328140940-c52993f25694 h1:+bAo7xKhITp0hqZWHaNqRt6wN50jxhktBHNhCWjAedI= @@ -346,8 +348,8 @@ github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFF github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c= -github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= +github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao= +github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= @@ -382,8 +384,8 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs= +github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -530,8 +532,8 @@ github.com/tencentyun/cos-go-sdk-v5 v0.7.73/go.mod h1:STbTNaNKq03u+gscPEGOahKzLc github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20250515025012-e0eec8a5d123/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw= github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= -github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s= -github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= +github.com/tinylib/msgp v1.6.4 h1:mOwYbyYDLPj35mkA2BjjYejgJk9BuHxDdvRnb6v2ZcQ= +github.com/tinylib/msgp v1.6.4/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o= @@ -546,8 +548,8 @@ github.com/urfave/cli/v3 v3.8.0 h1:XqKPrm0q4P0q5JpoclYoCAv0/MIvH/jZ2umzuf8pNTI= github.com/urfave/cli/v3 v3.8.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.69.0 h1:fNLLESD2SooWeh2cidsuFtOcrEi4uB4m1mPrkJMZyVI= -github.com/valyala/fasthttp v1.69.0/go.mod h1:4wA4PfAraPlAsJ5jMSqCE2ug5tqUPwKXxVj8oNECGcw= +github.com/valyala/fasthttp v1.71.0 h1:tepR7H+Guh9VUqxxcPggYi8R3lGUu2Rsdh+z7/FCY3k= +github.com/valyala/fasthttp v1.71.0/go.mod h1:z1sDUvOShhXq/C9mwH/fSm1Vb71tUJwmQdgkBrBNwnA= github.com/vektah/gqlparser/v2 v2.5.19 h1:bhCPCX1D4WWzCDvkPl4+TP1N8/kLrWnp43egplt7iSg= github.com/vektah/gqlparser/v2 v2.5.19/go.mod h1:y7kvl5bBlDeuWIvLtA9849ncyvx6/lj06RsMrEjVy3U= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -635,8 +637,8 @@ golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOM golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= -golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= -golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -675,8 +677,8 @@ golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= -golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -712,8 +714,8 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -731,8 +733,8 @@ golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= -golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU= -golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A= +golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= +golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -746,8 +748,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/routes/api.go b/routes/api.go index 8058296..94881f8 100644 --- a/routes/api.go +++ b/routes/api.go @@ -82,6 +82,24 @@ func Api() { return ctx.Response().String(http.StatusOK, "ok") }) + facades.Route().Get("timeout-isolated", func(ctx http.Context) http.Response { + token := ctx.Request().Query("token", "missing") + + select { + case <-time.After(4 * time.Second): + return ctx.Response().Success().String("late:" + token) + case <-ctx.Done(): + return ctx.Response().Status(http.StatusRequestTimeout).String("Request Timeout") + } + }) + facades.Route().Get("timeout-after", func(ctx http.Context) http.Response { + time.Sleep(1500 * time.Millisecond) + + return ctx.Response().Success().Json(http.Json{ + "token": ctx.Request().Query("token", "missing"), + }) + }) + facades.Route().Get("panic", func(ctx http.Context) http.Response { panic("test panic") }) diff --git a/tests/feature/http_test.go b/tests/feature/http_test.go index 6c9e9b7..94b813c 100644 --- a/tests/feature/http_test.go +++ b/tests/feature/http_test.go @@ -180,6 +180,27 @@ func (s *HttpTestSuite) TestTimeout() { resp.AssertStatus(contractshttp.StatusRequestTimeout) } +func (s *HttpTestSuite) TestTimeoutIsolation() { + timeoutResp, err := s.Http(s.T()).Get("/timeout-isolated?token=stale") + + s.Require().NoError(err) + timeoutResp.AssertStatus(contractshttp.StatusRequestTimeout) + + timeoutContent, err := timeoutResp.Content() + s.Require().NoError(err) + s.Equal("Request Timeout", timeoutContent) + + freshResp, err := s.Http(s.T()).Get("/timeout-after?token=fresh") + + s.Require().NoError(err) + freshResp.AssertSuccessful() + + freshContent, err := freshResp.Content() + s.Require().NoError(err) + s.Equal("{\"token\":\"fresh\"}", freshContent) + s.NotContains(freshContent, "stale") +} + func (s *HttpTestSuite) TestUrl() { resp, err := s.Http(s.T()).Get("/url/get/1?a=1&b=2") s.Require().NoError(err) @@ -187,7 +208,7 @@ func (s *HttpTestSuite) TestUrl() { content, err := resp.Content() s.Require().NoError(err) - s.Equal(`{"full_url":"http://example.com/url/get/1?a=1\u0026b=2","info":{"handler":"goravel/routes.Api.func11.1","method":"GET","name":"url.get","path":"/url/get/{id}"},"info1":{"handler":"goravel/routes.Api.func11.1","method":"GET|HEAD","name":"url.get","path":"/url/get/{id}"},"method":"GET","name":"url.get","origin_path":"/url/get/{id}","path":"/url/get/1","url":"/url/get/1?a=1\u0026b=2"}`, content) + s.Equal(`{"full_url":"http://example.com/url/get/1?a=1\u0026b=2","info":{"handler":"goravel/routes.Api.func13.1","method":"GET","name":"url.get","path":"/url/get/{id}"},"info1":{"handler":"goravel/routes.Api.func13.1","method":"GET|HEAD","name":"url.get","path":"/url/get/{id}"},"method":"GET","name":"url.get","origin_path":"/url/get/{id}","path":"/url/get/1","url":"/url/get/1?a=1\u0026b=2"}`, content) resp, err = s.Http(s.T()).Post("/url/post/1?a=1&b=2", strings.NewReader("{\"name\":\"Goravel\"}")) s.Require().NoError(err) @@ -195,7 +216,7 @@ func (s *HttpTestSuite) TestUrl() { content, err = resp.Content() s.Require().NoError(err) - s.Equal(`{"full_url":"http://example.com/url/post/1?a=1\u0026b=2","info":{"handler":"goravel/routes.Api.func11.2","method":"POST","name":"url.post","path":"/url/post/{id}"},"info1":{"handler":"goravel/routes.Api.func11.2","method":"POST","name":"url.post","path":"/url/post/{id}"},"method":"POST","name":"url.post","origin_path":"/url/post/{id}","path":"/url/post/1","url":"/url/post/1?a=1\u0026b=2"}`, content) + s.Equal(`{"full_url":"http://example.com/url/post/1?a=1\u0026b=2","info":{"handler":"goravel/routes.Api.func13.2","method":"POST","name":"url.post","path":"/url/post/{id}"},"info1":{"handler":"goravel/routes.Api.func13.2","method":"POST","name":"url.post","path":"/url/post/{id}"},"method":"POST","name":"url.post","origin_path":"/url/post/{id}","path":"/url/post/1","url":"/url/post/1?a=1\u0026b=2"}`, content) } func (s *HttpTestSuite) TestUsers() { From b714b80a67e25f6076456d52c47db1c34b55d734 Mon Sep 17 00:00:00 2001 From: Bowen Date: Sun, 24 May 2026 12:58:04 +0800 Subject: [PATCH 2/4] optimize --- routes/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/api.go b/routes/api.go index 94881f8..edb6739 100644 --- a/routes/api.go +++ b/routes/api.go @@ -89,7 +89,7 @@ func Api() { case <-time.After(4 * time.Second): return ctx.Response().Success().String("late:" + token) case <-ctx.Done(): - return ctx.Response().Status(http.StatusRequestTimeout).String("Request Timeout") + return nil } }) facades.Route().Get("timeout-after", func(ctx http.Context) http.Response { From aace93d0226f62f2860fed509159bf630148b708 Mon Sep 17 00:00:00 2001 From: Bowen Date: Sun, 24 May 2026 13:14:46 +0800 Subject: [PATCH 3/4] test: address timeout regression review feedback Derive timeout overlap timings from config, stop timers explicitly, and make route URL assertions resilient to compiler-generated handler names. --- routes/api.go | 32 +++++++++++++-- tests/feature/http_test.go | 79 ++++++++++++++++++++++++++++++++++---- 2 files changed, 101 insertions(+), 10 deletions(-) diff --git a/routes/api.go b/routes/api.go index edb6739..4e7b098 100644 --- a/routes/api.go +++ b/routes/api.go @@ -12,7 +12,11 @@ import ( "goravel/app/http/middleware" ) +const timeoutIsolationBuffer = 500 * time.Millisecond + func Api() { + timeoutIsolationDelay, timeoutAfterDelay := timeoutIsolationDurations() + // Auth authController := controllers.NewAuthController() facades.Route().Prefix("jwt").Group(func(route route.Router) { @@ -84,16 +88,18 @@ func Api() { facades.Route().Get("timeout-isolated", func(ctx http.Context) http.Response { token := ctx.Request().Query("token", "missing") + timer := time.NewTimer(timeoutIsolationDelay) + defer stopTimer(timer) select { - case <-time.After(4 * time.Second): + case <-timer.C: return ctx.Response().Success().String("late:" + token) case <-ctx.Done(): - return nil + return ctx.Response().Status(http.StatusRequestTimeout).String("Request Timeout") } }) facades.Route().Get("timeout-after", func(ctx http.Context) http.Response { - time.Sleep(1500 * time.Millisecond) + time.Sleep(timeoutAfterDelay) return ctx.Response().Success().Json(http.Json{ "token": ctx.Request().Query("token", "missing"), @@ -198,3 +204,23 @@ func Api() { return ctx.Response().Success().String(body) }) } + +func timeoutIsolationDurations() (time.Duration, time.Duration) { + requestTimeout := time.Duration(facades.Config().GetInt("http.request_timeout", 3)) * time.Second + if requestTimeout <= 0 { + requestTimeout = 3 * time.Second + } + + return requestTimeout + timeoutIsolationBuffer, requestTimeout - timeoutIsolationBuffer +} + +func stopTimer(timer *time.Timer) { + if timer.Stop() { + return + } + + select { + case <-timer.C: + default: + } +} diff --git a/tests/feature/http_test.go b/tests/feature/http_test.go index 94b813c..d9d5ef3 100644 --- a/tests/feature/http_test.go +++ b/tests/feature/http_test.go @@ -198,7 +198,6 @@ func (s *HttpTestSuite) TestTimeoutIsolation() { freshContent, err := freshResp.Content() s.Require().NoError(err) s.Equal("{\"token\":\"fresh\"}", freshContent) - s.NotContains(freshContent, "stale") } func (s *HttpTestSuite) TestUrl() { @@ -206,17 +205,83 @@ func (s *HttpTestSuite) TestUrl() { s.Require().NoError(err) resp.AssertSuccessful() - content, err := resp.Content() - s.Require().NoError(err) - s.Equal(`{"full_url":"http://example.com/url/get/1?a=1\u0026b=2","info":{"handler":"goravel/routes.Api.func13.1","method":"GET","name":"url.get","path":"/url/get/{id}"},"info1":{"handler":"goravel/routes.Api.func13.1","method":"GET|HEAD","name":"url.get","path":"/url/get/{id}"},"method":"GET","name":"url.get","origin_path":"/url/get/{id}","path":"/url/get/1","url":"/url/get/1?a=1\u0026b=2"}`, content) + var getResponse struct { + FullURL string `json:"full_url"` + Info struct { + Handler string `json:"handler"` + Method string `json:"method"` + Name string `json:"name"` + Path string `json:"path"` + } `json:"info"` + Info1 struct { + Handler string `json:"handler"` + Method string `json:"method"` + Name string `json:"name"` + Path string `json:"path"` + } `json:"info1"` + Method string `json:"method"` + Name string `json:"name"` + OriginPath string `json:"origin_path"` + Path string `json:"path"` + URL string `json:"url"` + } + + s.Require().NoError(resp.Bind(&getResponse)) + s.Equal("http://example.com/url/get/1?a=1&b=2", getResponse.FullURL) + s.Equal("GET", getResponse.Info.Method) + s.Equal("url.get", getResponse.Info.Name) + s.Equal("/url/get/{id}", getResponse.Info.Path) + s.Contains(getResponse.Info.Handler, "goravel/routes.Api.") + s.Equal("GET|HEAD", getResponse.Info1.Method) + s.Equal("url.get", getResponse.Info1.Name) + s.Equal("/url/get/{id}", getResponse.Info1.Path) + s.Contains(getResponse.Info1.Handler, "goravel/routes.Api.") + s.Equal("GET", getResponse.Method) + s.Equal("url.get", getResponse.Name) + s.Equal("/url/get/{id}", getResponse.OriginPath) + s.Equal("/url/get/1", getResponse.Path) + s.Equal("/url/get/1?a=1&b=2", getResponse.URL) resp, err = s.Http(s.T()).Post("/url/post/1?a=1&b=2", strings.NewReader("{\"name\":\"Goravel\"}")) s.Require().NoError(err) resp.AssertSuccessful() - content, err = resp.Content() - s.Require().NoError(err) - s.Equal(`{"full_url":"http://example.com/url/post/1?a=1\u0026b=2","info":{"handler":"goravel/routes.Api.func13.2","method":"POST","name":"url.post","path":"/url/post/{id}"},"info1":{"handler":"goravel/routes.Api.func13.2","method":"POST","name":"url.post","path":"/url/post/{id}"},"method":"POST","name":"url.post","origin_path":"/url/post/{id}","path":"/url/post/1","url":"/url/post/1?a=1\u0026b=2"}`, content) + var postResponse struct { + FullURL string `json:"full_url"` + Info struct { + Handler string `json:"handler"` + Method string `json:"method"` + Name string `json:"name"` + Path string `json:"path"` + } `json:"info"` + Info1 struct { + Handler string `json:"handler"` + Method string `json:"method"` + Name string `json:"name"` + Path string `json:"path"` + } `json:"info1"` + Method string `json:"method"` + Name string `json:"name"` + OriginPath string `json:"origin_path"` + Path string `json:"path"` + URL string `json:"url"` + } + + s.Require().NoError(resp.Bind(&postResponse)) + s.Equal("http://example.com/url/post/1?a=1&b=2", postResponse.FullURL) + s.Equal("POST", postResponse.Info.Method) + s.Equal("url.post", postResponse.Info.Name) + s.Equal("/url/post/{id}", postResponse.Info.Path) + s.Contains(postResponse.Info.Handler, "goravel/routes.Api.") + s.Equal("POST", postResponse.Info1.Method) + s.Equal("url.post", postResponse.Info1.Name) + s.Equal("/url/post/{id}", postResponse.Info1.Path) + s.Contains(postResponse.Info1.Handler, "goravel/routes.Api.") + s.Equal("POST", postResponse.Method) + s.Equal("url.post", postResponse.Name) + s.Equal("/url/post/{id}", postResponse.OriginPath) + s.Equal("/url/post/1", postResponse.Path) + s.Equal("/url/post/1?a=1&b=2", postResponse.URL) } func (s *HttpTestSuite) TestUsers() { From 486c9fa2ea1c32753b33294e849d86663f2032ba Mon Sep 17 00:00:00 2001 From: Bowen Date: Thu, 28 May 2026 17:27:01 +0800 Subject: [PATCH 4/4] fix: align example fiber config with v3 imports Promote Fiber v3 packages to direct dependencies so package install flows no longer inject duplicate imports into config/http.go during package install and publish tests. --- config/http.go | 4 ++-- go.mod | 8 ++------ go.sum | 8 -------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/config/http.go b/config/http.go index 8a548f1..d4e497a 100644 --- a/config/http.go +++ b/config/http.go @@ -2,8 +2,8 @@ package config import ( "github.com/gin-gonic/gin/render" - "github.com/gofiber/fiber/v2" - "github.com/gofiber/template/html/v2" + "github.com/gofiber/fiber/v3" + "github.com/gofiber/template/html/v3" fiberfacades "github.com/goravel/fiber/facades" "github.com/goravel/framework/contracts/route" "github.com/goravel/framework/support/path" diff --git a/go.mod b/go.mod index ed6c6db..ba126d0 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.25.0 require ( github.com/99designs/gqlgen v0.17.57 github.com/gin-gonic/gin v1.12.0 - github.com/gofiber/fiber/v2 v2.52.12 - github.com/gofiber/template/html/v2 v2.1.3 + github.com/gofiber/fiber/v3 v3.2.0 + github.com/gofiber/template/html/v3 v3.0.4 github.com/goravel/cos v1.17.1-0.20260323021954-3ddc163693ee github.com/goravel/example-proto v0.0.1 github.com/goravel/fiber v1.17.1-0.20260524040519-047523ffa71c @@ -107,12 +107,8 @@ require ( github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/goccy/go-json v0.10.5 // indirect github.com/goccy/go-yaml v1.19.2 // indirect - github.com/gofiber/fiber/v3 v3.2.0 // indirect github.com/gofiber/schema v1.7.1 // indirect - github.com/gofiber/template v1.8.3 // indirect - github.com/gofiber/template/html/v3 v3.0.4 // indirect github.com/gofiber/template/v2 v2.1.0 // indirect - github.com/gofiber/utils v1.1.0 // indirect github.com/gofiber/utils/v2 v2.0.5 // indirect github.com/goforj/godump v1.9.1 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect diff --git a/go.sum b/go.sum index ec93a1c..1d37e7b 100644 --- a/go.sum +++ b/go.sum @@ -235,22 +235,14 @@ github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= -github.com/gofiber/fiber/v2 v2.52.12 h1:0LdToKclcPOj8PktUdIKo9BUohjjwfnQl42Dhw8/WUw= -github.com/gofiber/fiber/v2 v2.52.12/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= github.com/gofiber/fiber/v3 v3.2.0 h1:g9+09D320foINPpCnR3ibQ5oBEFHjAWRRfDG1te54u8= github.com/gofiber/fiber/v3 v3.2.0/go.mod h1:FHOsc2Db7HhHpsE62QAaJlXVV1pNkbZEptZ4jtti7m4= github.com/gofiber/schema v1.7.1 h1:oSJBKdgP8JeIME4TQSAqlNKTU2iBB+2RNmKi8Nsc+TI= github.com/gofiber/schema v1.7.1/go.mod h1:A/X5Ffyru4p9eBdp99qu+nzviHzQiZ7odLT+TwxWhbk= -github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc= -github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8= -github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6dFLp8ea+o= -github.com/gofiber/template/html/v2 v2.1.3/go.mod h1:U5Fxgc5KpyujU9OqKzy6Kn6Qup6Tm7zdsISR+VpnHRE= github.com/gofiber/template/html/v3 v3.0.4 h1:0wNAQtC6QepN9YBDoZCq+vdMxsCwSafxWF/8/Zm0wxk= github.com/gofiber/template/html/v3 v3.0.4/go.mod h1:Fw2JD0ALJQBsjwNc4crVtIwBUw5cbJngjW5J+mpKFXQ= github.com/gofiber/template/v2 v2.1.0 h1:vrLY6uEW2HdioJm6J5FGUpYZuapVQhHciNz21XQjR/4= github.com/gofiber/template/v2 v2.1.0/go.mod h1:ohgpR/Ng90nJbK+IyNzrgR/XpnBNt862/oTF5G7SAmE= -github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM= -github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0= github.com/gofiber/utils/v2 v2.0.5 h1:IMXoI2A5Dao/aMMBURTNxnhbtQO4kUwUFOgcwFSIjLU= github.com/gofiber/utils/v2 v2.0.5/go.mod h1:FwwopfzwAQsoXLCHhOT24eH2jQfBgrrra9S5p0+luxg= github.com/goforj/godump v1.9.1 h1:9OGpb978Ytz3B59d5Yi2PzRYYLid6UkmhYDIDNiF15Y=