Skip to content

Feature implementation from commits a569ed8..f2c861a#2

Open
yashuatla wants to merge 15 commits intofeature-base-2from
feature-head-2
Open

Feature implementation from commits a569ed8..f2c861a#2
yashuatla wants to merge 15 commits intofeature-base-2from
feature-head-2

Conversation

@yashuatla
Copy link
Copy Markdown
Owner

@yashuatla yashuatla commented Jun 25, 2025

PR Summary

Test Framework Improvements and URL Path Handling Enhancements

Overview

This PR improves test reliability by replacing assert with require in test files and adds support for escaped colons in URL paths along with YAML MIME type handling.

Change Types

Type Description
Enhancement Added support for MIMEYAML2 MIME type in Context.Negotiate
Enhancement Added support for escaped colons in URL paths
Bugfix Added nil check before calling nameOfFunction() to prevent runtime panic
Refactor Changed test assertions from assert to require for improved test failure handling

Affected Modules

Module / File Change Description
binding_*.go Replaced assert with require in test files
context.go Added MIMEYAML2 support and nil check for handlers
context_test.go Updated tests for MIMEYAML2 and improved assertions
gin.go Added updateRouteTree and updateRouteTrees functions
tree_test.go Added tests for escaped colons in URL paths
render_test.go Improved test assertions
debug_test.go Improved test assertions
fs_test.go Improved test assertions

Notes for Reviewers

  • The change from assert to require makes tests fail immediately on error rather than continuing with invalid state
  • New URL path handling for escaped colons should be thoroughly tested
  • Verify that the nil check for handlers properly prevents potential panics

1911860538 and others added 15 commits May 13, 2024 13:32
…c#3910)

* Simplify SliceValidationError Error method

* Replace fmt.Fprintf with b.WriteString

---------

Co-authored-by: huangzw <huangzw@hsmap.com>
Co-authored-by: 1911860538 <alxps1911@163.com>
* fixed gin-gonic#3404 2022-11-23

* up 2022-11-23

* refactor: refactor context handling and nil checks

- Refactor nil checks to improve readability in `context.go`
- Modify the control flow in `HandlerNames` and `Next` methods to continue on nil values before appending or invoking handlers in `context.go`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* test: refactor context_test.go for clarity and efficiency

- Insert a `nil` value into the `HandlersChain` array in `context_test.go`
- Remove empty test functions in `context_test.go`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
…gin-gonic#4003)

Signed-off-by: Pierre-Henri Symoneaux <pierre-henri.symoneaux@ovhcloud.com>
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.25.0 to 0.27.0.
- [Commits](golang/net@v0.25.0...v0.27.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat(form): add array collection format in form binding

* feat(form): add array collection format in form binding

* test(form): fix test code for array collection format in form binding
- Use specified default value in struct tags when binding a request input to struct for validation, even if sent empty, not only when not sent at all.
- Add string field to `TestMappingDefault` test case.
- Add test case for not sent form field to default to the value specified via code.
- Add test case for form field sent empty to default to the value specified via code.

Fixes: How to apply default value if empty value provided by client during model binding? gin-gonic#4042, #13042df, #a41721a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.