Feature implementation from commits fa70d2b..0c6283f#2
Open
yashuatla wants to merge 15 commits into
Open
Conversation
* 🔥 feat: Add Support for Removing Routes (gofiber#3230) * Add new methods named RemoveRoute and RemoveRouteByName. * Update register method to prevent duplicate routes. * Clean up tests * Update docs * Update router.go * Fix markdown * Some fixes * update * test * fix removing logic * fix tests * fix tests * update docs * fix tests * Update docs/api/app.md * Apply suggestions from code review * update methods behavior of removeroute * 🔥 feat: Add Support for Removing Routes gofiber#3230 --------- Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com> Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com> Co-authored-by: Muhammed Efe Cetin <efectn@protonmail.com> Co-authored-by: RW <rene@gofiber.io>
Revert bound typo fixes
* Expand Test_Utils_Parse_Address * Update implementation based on Codex * Remove duplicated func * Update test fmt * format * Update helpers_test.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * more format * more format --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…#3467) * Fix proxy middleware tests to avoid external network * Update proxy_test.go * Update middleware/proxy/proxy_test.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update proxy_test.go --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Remove extra header sanitization
…ofiber#3440) * build(deps): bump github.com/valyala/fasthttp from 1.60.0 to 1.62.0 Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.60.0 to 1.62.0. - [Release notes](https://github.com/valyala/fasthttp/releases) - [Commits](valyala/fasthttp@v1.60.0...v1.62.0) --- updated-dependencies: - dependency-name: github.com/valyala/fasthttp dependency-version: 1.62.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Fix CSRF middleware tests for fasthttp 1.62 (gofiber#3471) Fix CSRF tests for fasthttp 1.62 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: RW <rene@gofiber.io>
clarify dependency check
Clarify conditional startup script skip
adpater / HTTPHandler NEW Benchmark_HTTPHandler-12 1762837 640.6 ns/op 696 B/op 10 allocs/op Benchmark_HTTPHandler-12 1924524 616.5 ns/op 696 B/op 10 allocs/op Benchmark_HTTPHandler-12 1838780 650.4 ns/op 696 B/op 10 allocs/op Benchmark_HTTPHandler-12 1876947 644.0 ns/op 696 B/op 10 allocs/op OLD Benchmark_HTTPHandler-12 1864819 667.2 ns/op 720 B/op 11 allocs/op Benchmark_HTTPHandler-12 1892569 677.0 ns/op 720 B/op 11 allocs/op Benchmark_HTTPHandler-12 1811704 639.5 ns/op 720 B/op 11 allocs/op Benchmark_HTTPHandler-12 1879849 644.0 ns/op 720 B/op 11 allocs/op Utils / IsNoCache NEW Benchmark_Utils_IsNoCache-12 44307204 27.08 ns/op 0 B/op 0 allocs/op Benchmark_Utils_IsNoCache-12 40782919 26.88 ns/op 0 B/op 0 allocs/op Benchmark_Utils_IsNoCache-12 44228217 26.69 ns/op 0 B/op 0 allocs/op Benchmark_Utils_IsNoCache-12 45605700 26.75 ns/op 0 B/op 0 allocs/op OLD Benchmark_Utils_IsNoCache-12 30043908 37.80 ns/op 0 B/op 0 allocs/op Benchmark_Utils_IsNoCache-12 32137476 37.51 ns/op 0 B/op 0 allocs/op Benchmark_Utils_IsNoCache-12 31474653 37.92 ns/op 0 B/op 0 allocs/op Benchmark_Utils_IsNoCache-12 31838683 37.71 ns/op 0 B/op 0 allocs/op
* ♻️ refact: make genericParseType return error * 🐛 fix: return error when parsing unsupported type * 🚨 test: cover the default value for Params * 🚨 test: cover default value on parsing error * ♻️ refact: change the benchmark name * 🚨 test: remove the duplicated maxUint16 test case --------- Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
* Ctx implements context.Context * fix up some linting issues * added some tests * no message * fiber.Ctx implements context.Context * no message * implement compile-time check * update formatting * update compile-time checks --------- Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
| removedUseRoutes[route.path] = struct{}{} | ||
| } | ||
|
|
||
| atomic.AddUint32(&app.handlersCount, ^uint32(len(route.Handlers)-1)) //nolint:gosec // Not a concern |
There was a problem hiding this comment.
🐛 Correctness Issue
Potentially confusing atomic decrement operation.
The atomic decrement using bitwise complement (^uint32) is an uncommon pattern that could lead to incorrect handler counting and application instability.
Current Code (Diff):
- atomic.AddUint32(&app.handlersCount, ^uint32(len(route.Handlers)-1)) //nolint:gosec // Not a concern
+ atomic.AddUint32(&app.handlersCount, ^uint32(0) - uint32(len(route.Handlers)-1)) //nolint:gosec // Not a concern📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
Suggested change
| atomic.AddUint32(&app.handlersCount, ^uint32(len(route.Handlers)-1)) //nolint:gosec // Not a concern | |
| atomic.AddUint32(&app.handlersCount, ^uint32(0) - uint32(len(route.Handlers)-1)) //nolint:gosec // Not a concern |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Bug Fixes and Route Management Enhancements
Overview
This PR addresses several bugs in the request header handling and test reliability while adding new route management capabilities to the App struct.
Change Types
Affected Modules
ctx.goctx_test.goproxy/proxy_test.gotimeout/timeout_test.gorouter.goNotes for Reviewers