Commit Graph

1780 Commits

Author SHA1 Message Date
TimAndy 671bb17bd9 feat: support custom json codec at runtime 2024-06-12 13:39:22 +08:00
TimAndy 973c555810 Export json codec 2024-06-12 13:39:20 +08:00
Meng Zhuo 64ead9e6bd
docs(readme): replace godoc with pkg (#3985)
* Update README.md
2024-06-06 17:10:03 +08:00
wssccc 4621b7ac98
feat(router): add literal colon support (#1432) (#2857) 2024-06-01 13:44:57 +08:00
Endless Paradox 334160bab7
chore(tree): replace the self-defined 'min' to official one (#3975) 2024-05-24 14:55:25 +08:00
bruceNu1l 24d67647cb
feat(form): add custom string slice for form tag unmarshal (#3970) (#3971)
Co-authored-by: Bruce Lee <admin@ifocusad.com>
2024-05-23 10:16:11 +08:00
Adriano Sela Aviles e0d46ded6c
fix(context): verify URL is Non-nil in initQueryCache() (#3969) 2024-05-19 10:48:07 +08:00
RedCrazyGhost 4f339e6a35
fix(context): YAML judgment logic in Negotiate (#3966) 2024-05-14 10:25:54 +08:00
51pwn 36b0dede4b
fix(context): check handler is nil (#3413)
* fixed #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>
2024-05-13 14:55:41 +08:00
Name 3f5b0afa2a
refactor(slice): simplify SliceValidationError Error method (#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>
2024-05-13 13:32:46 +08:00
crunchyfrog a569ed8f26
docs(readme): fix language and moved link (#3962)
* Update README.md

* more fixes & fix moved link
2024-05-13 11:12:55 +08:00
guonaihong 6ca8ddb1ae
feat(binding): add BindPlain (#3904)
* add BindPlain

* fix ci/cd error
2024-05-13 11:11:56 +08:00
Mobin Mohanan 40131af124
ci(Makefile): added help and descriptions to targets (#3964) 2024-05-13 09:29:21 +08:00
thinkerou c677ccc40a
fix(go): invalid Go toolchain version (#3961) 2024-05-10 07:27:42 +08:00
Bo-Yi Wu 7e298066ba
build: update Gin minimum Go version to 1.21 (#3960)
* build: update Gin minimum Go version to 1.21

- Update the minimum Go version requirement for Gin from `1.20` to `1.21` in both `debug.go` and `debug_test.go`
- Modify the warning message to reflect the new minimum Go version requirement in `debug.go`
- Adjust the test assertion to match the updated warning message in `debug_test.go`

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

* docs: refine project documentation and CI configurations

- Update supported Go versions for GitHub actions to `1.21` and `1.22`
- Specify the required Go version as `1.21` or above in README
- Change code block syntax to `sh` in installation and demo run instructions
- Remove empty lines in README sections
- Update project list formatting without changing the content

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

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-09 13:45:03 +08:00
thinkerou 3ac729dc4a
feat(gin): support http3 using quic-go/quic-go (#3210)
* experimental support http3

* remove go1.14 and go1.15

* update quic-go package path

* only support go1.19+

* remove go19 support

* update gomod

* chore: refine CI configuration and dependencies

- Remove dynamic Go versioning in favor of pinning to major version `1`
- Update linter version from `v1.56.2` to `v1.58.1` in GitHub Actions workflow

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

* chore: refactor CI workflow and improve tests

- Update the golangci-lint-action version from `v5` to `v6` in the GitHub workflow configuration

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

* chore: update dependencies and CI configurations

- Update Go version requirement from `1.20` to `1.21` in `go.mod`

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

* style: refactor codebase and update tests

- Add an empty line in the import section of `gin.go`

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

* chore: enhance code quality and consistency

- Add `gin.go` to the list of files with specific linters in `.golangci.yml`, applying the `gci` linter.

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>
2024-05-09 09:17:06 +08:00
Johannes Eiglsperger 8791c96960
feat(fs): Export, test and document OnlyFilesFS (#3939) 2024-05-08 15:47:54 +08:00
Bo-Yi Wu b1c1e7b572
ci: update Go version requirements and remove test files (#3957)
- Update the Go version requirements in `.github/workflows/gin.yml`
- Remove test files for Go versions 1.18 and 1.19
- Update the required Go version in `debug.go` and `debug_test.go`
- Rename and modify files related to Go version 1.19 and 1.20 in the `internal/bytesconv` directory

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-08 10:14:42 +08:00
Kostadin Plachkov 7d147928ee
fix(gin): data race warning for gin mode (#1580)
* fix: data race warning (#1180)

* Fix the tests

* refactor: remove unnecessary imports and optimize codebase

- Remove unnecessary import of `flag`

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

* test: refactor test assertions for mode settings

- Update test assertions for mode setting in `mode_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>
2024-05-08 09:13:36 +08:00
Pedro Aguiar f5f5da8fa0
docs(gin): update link to dont-trust-all-proxies section (#3938) (#3945)
Update link [1] to [2] after PR #3449 was merged.

[1] https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies
[2] https://github.com/gin-gonic/gin/blob/master/docs/doc.md#dont-trust-all-proxies

Closes
2024-05-08 06:31:01 +08:00
lgbgbl 8dd088927a
refactor(binding): use strings.Cut to replace strings.Index (#3522) 2024-05-08 06:28:15 +08:00
Flc゛ e60113dc95
docs(engine): fix comments for the `With` (#3955)
Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
2024-05-08 05:29:54 +08:00
Bo-Yi Wu 490accf5d7
docs: update documentation and release notes for Gin v1.10.0 (#3953)
* docs: update documentation and release notes for Gin v1.10.0

- Add release notes for Gin v1.10.0
- Include new features and bug fixes in the changelog
- Document enhancements and build process updates
- Update documentation for context and middleware functions
- Upgrade dependencies and optimize unit tests

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

* feat: refactor CI, enhance file binding, and update dependencies

- Add proxy-server authentication feature
- Add support for custom BindUnmarshaler for binding
- Fix binding error while not uploading file
- Refactor CI and update dependencies
- Add support for RFC 9512: application/yaml
- Optimize the Copy method of the Context struct
- Update various Go dependencies to latest versions

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

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-07 12:50:01 +08:00
Bo-Yi Wu 75ccf94d60
feat: update version constant to v1.10.0 (#3952)
- Update the version constant from "v1.9.1" to "v1.10.0"

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-07 11:23:42 +08:00
Bo-Yi Wu 39089af625
chore: refactor configuration files for better readability (#3951)
- Remove filters from the `changelog` section in `.goreleaser.yaml`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-07 10:16:38 +08:00
Bo-Yi Wu 638aa19e7d
chore: update external dependencies to latest versions (#3950)
- Update `github.com/go-playground/validator/v10` from v10.19.0 to v10.20.0
- Update `github.com/pelletier/go-toml/v2` from v2.2.0 to v2.2.2
- Update `golang.org/x/net` from v0.22.0 to v0.25.0
- Update `google.golang.org/protobuf` from v1.33.0 to v1.34.1
- Update `golang.org/x/arch` from v0.7.0 to v0.8.0
- Update `golang.org/x/crypto` from v0.21.0 to v0.23.0
- Update `golang.org/x/sys` from v0.18.0 to v0.20.0
- Update `golang.org/x/text` from v0.14.0 to v0.15.0

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-07 10:15:53 +08:00
dkkb a18219566c
feat(binding): Support custom BindUnmarshaler for binding. (#3933) 2024-05-07 09:43:15 +08:00
dependabot[bot] b4f66e965b
chore(deps): bump github.com/bytedance/sonic from 1.11.3 to 1.11.6 (#3940)
Bumps [github.com/bytedance/sonic](https://github.com/bytedance/sonic) from 1.11.3 to 1.11.6.
- [Release notes](https://github.com/bytedance/sonic/releases)
- [Commits](https://github.com/bytedance/sonic/compare/v1.11.3...v1.11.6)

---
updated-dependencies:
- dependency-name: github.com/bytedance/sonic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-30 07:07:23 +08:00
dependabot[bot] f80ade7a4b
chore(deps): bump golangci/golangci-lint-action from 4 to 5 (#3941)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4 to 5.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-30 07:07:01 +08:00
Bo-Yi Wu 0397e5e0c0
chore: update changelog categories and improve documentation (#3917)
- Add new changelog categories for "Build process updates" and "Documentation updates"

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-04-07 10:18:23 +08:00
Bo-Yi Wu c6f90df4e0
chore: update various Go dependencies to latest versions (#3901)
- Update `github.com/bytedance/sonic` from v1.11.0 to v1.11.3
- Update `github.com/go-playground/validator/v10` from v10.18.0 to v10.19.0
- Update `github.com/pelletier/go-toml/v2` from v2.1.1 to v2.2.0
- Update `github.com/stretchr/testify` from v1.8.4 to v1.9.0
- Update `golang.org/x/net` from v0.21.0 to v0.22.0
- Update `golang.org/x/crypto` from v0.19.0 to v0.21.0
- Update `golang.org/x/sys` from v0.17.0 to v0.18.0

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-04-02 18:57:22 +08:00
Bo-Yi Wu 8acbe657f1
ci(release): refactor changelog regex patterns and exclusions (#3914)
* chore: refactor changelog regex patterns and exclusions

- Update the build configuration to skip the build using a comment
- Change the `changelog` use from `git` to `github`
- Modify the regex patterns for `Features`, `Bug fixes`, and `Enhancements` titles in the changelog
- Add a new regex pattern for the `Refactor` title in the changelog
- Update the excluded items in the changelog to include `docs` and `CICD` with corrected quotes

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

* chore: update configuration file field names

- Change the `skip` field to `disable` in the `.goreleaser.yaml` file.

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

* update

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

* chore: refine changelog categorization rules

- Update regular expressions for `feat`, `fix`, and `chore` categories in `.goreleaser.yaml`
- Remove `Refactor` category from changelog configuration
- Add `Refactor` category with updated regular expression and order to changelog configuration

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

---------

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-04-02 16:20:48 +08:00
imalasong 56dc72c4d5
ci(Makefile): vet command add .PHONY (#3915) 2024-04-02 11:58:00 +08:00
Name c964ad370b
chore(optimize): the ShouldBindUri method of the Context struct (#3911)
Co-authored-by: huangzw <huangzw@hsmap.com>
2024-04-01 12:58:01 +08:00
RedCrazyGhost 7a865dcf1d
feat(bind): ShouldBindBodyWith shortcut and change doc (#3871)
* feat: ShouldBindBodyWith shortcut and change doc

* fix: yaml can parse json test case

* style: fix new test case in context_test.go

* chore: modify the code style to specify binding type

* chroe: gofmt modifies the code format
2024-03-23 22:09:02 +08:00
ssfyn fd1faaded0
feat(binding): support override default binding implement (#3514) 2024-03-23 08:50:25 +08:00
Bo-Yi Wu d4e4136488
Revert "fix(uri): query binding bug (#3236)" (#3899)
This reverts commit 8790d08909.
2024-03-22 10:01:27 +08:00
illiafox 8790d08909
fix(uri): query binding bug (#3236)
* fix query mapping

* query binding test
2024-03-21 22:28:42 +08:00
Flc゛ 78f4687875
build(codecov): Added a codecov configuration (#3891)
Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
2024-03-21 21:13:56 +08:00
Farmer.Chillax 2b1da2b0b3
fix(context): make context Value method adhere to Go standards (#3897) 2024-03-21 21:08:41 +08:00
Guilherme Aleixo 0d9dbbb445
chore(security): upgrade Protobuf for CVE-2024-24786 (#3893) 2024-03-18 22:14:06 +08:00
Flc゛ fd60a24ab7
test(path): Optimize unit test execution results (#3883)
* test(path): Add a GC recycle validation

* test(path): Optimize unit test execution results

* test(path): Optimize unit test execution results
2024-03-14 11:22:54 +08:00
Endless Paradox ee70b30a97
docs: Add document to constant `AuthProxyUserKey` and `BasicAuthForProxy`. (#3887) 2024-03-13 23:22:05 +08:00
Flc゛ 990c44aebf
docs(context): Added deprecation comments to BindWith (#3880) 2024-03-12 13:55:52 +08:00
Endless Paradox 861ffb9181
docs(middleware): comments to function `BasicAuthForProxy` (#3881) 2024-03-12 13:51:04 +08:00
Flc゛ f70dd00b00
fix(engine): fix unit test (#3878)
* fix(engine): fix unit test

* fix(engine): fix unit test
2024-03-12 13:49:23 +08:00
Noah Yao ab8042e9e5
chore(request): check reader if it's nil before reading (#3419) 2024-03-11 22:44:28 +08:00
Jose Diaz-Gonzalez 1b3c085969
chore(debug): add ability to override the debugPrint statement (#2337)
* feat: add ability to override the debugPrint statement

This allows users to use a single logger within their application for all printing, regardless of level.

* chore: make the code more readable, as per review comment

* fix: use tab instead of space for indentation
2024-03-11 22:41:07 +08:00
Flc゛ ac5e84d93c
feat(engine): Added `OptionFunc` and `With` (#3572)
* feat: Added `OptionFunc` and `With`

* fix: `With(opts...)` must be after `New`

* feat: improve New with

* fix: test

* optimize code

* optimize nolint

* optimize code

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>

---------

Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
2024-03-11 22:35:30 +08:00
TotomiEcio 83fc7673f9
docs: fix typo in function documentation (#3872) 2024-03-11 22:25:28 +08:00