Register the path directive by default, but it only supports encoding function. For a complete path directive, users still need to use the integration subpackage:
Include encoding functionality to this package. From now on, httpin doesn't only support decoding an HTTP request to a Go struct, it supports encoding a Go struct to an HTTP request as well. Simply call httpin.NewRequest method. Because all the builtin directives now support encoding functions.
Introduced a new directive named nonzero. Which is used to cover/correct miss-use of the required directive, use nonzero instead of required to ensure that the field not be a zero/empty value.
For custom struct types, you don't need to register it to httpin any more, as long as you implement the Stringable interface.
Breaking Changes
Less APIs are exposed under package httpin. I hope the list will be limited to the following, which I would like to keep in the first stable release (v1.0.0):
httpin.New: creates a core.Core instance;
httpin.NewInput: creates a HTTP middleware;
httpin.Input: the context key to retrieve the decoded struct instance that was injected to http.Request.Context by httpin;
httpin.Decode: decode an HTTP request to a struct instance;
httpin.NewRequest: encode a struct instance to an HTTP request;
httpin.NewRequestWithContext: call httpin.NewRequest with a context.Context;
httpin.File: the type for manipulating file uploading in httpin;
httpin.UploadFile: upload file by filename;
httpin.UploadStream: upload file by stream.
APIs to integrate with third-party packages are moved to the integration subpackage:
httpin.UseGochiURLParam: registers a path directive for the gochi routing package, use httpin_integration.UseGochiURLParam instead;
httpin.UseGorillaMux: registers a path directive for the gorilla/mux routing package, use httpin_integration.UseGorillaMux instead;
All the other APIs used to extend http functions are moved to core subpackage and many of them have been changed because the newly introduced encoding ability:
httpin.RegisterValueTypeDecoder[T]: use httpin_core.RegisterCoder instead;
httpin.RegisterNamedDecoder[T]: use httpin_core.RegisterNamedCoder[T] instead;
httpin.RegisterFileTypeDecoder[T]: use httpin_core.RegisterFileCoder[T] instead;
httpin.RegisterBodyDecoder: use httpin_core.RegisterBodyFormat instead;
httpin.ReplaceDefaultErrorHandler: use httpin_core.RegisterErrorHandler instead;
DEPRECATED httpin.ReplaceValueTypeDecoder[T]: use httpin_core.RegisterCoder instead;
DEPRECATED httpin.ReplaceNamedDecoder[T]: use httpin_core.RegisterNamedCoder[T] instead;
DEPRECATED httpin.ReplaceFileTypeDecoder[T]: use httpin_core.RegisterFileCoder[T] instead;
... (truncated)
Commits
5dca4c8 Merge pull request #92 from ggicci/fix/88-streaming
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps github.com/ggicci/httpin from 0.14.2 to 0.15.3.
Release notes
Sourced from github.com/ggicci/httpin's releases.
... (truncated)
Commits
5dca4c8
Merge pull request #92 from ggicci/fix/88-streamingd7c8134
fix: issue 88, streamingfbcb1f2
Merge pull request #91 from alecsammon/unknown_body_type_error1b09f0b
Add custom ErrUnknownBodyFormat5d958eb
Merge pull request #82 from ggicci/dependabot/github_actions/actions/setup-go-540647db
feat: register path directive by default, but support encoding only923ff2f
fix: encoding post form bug3e64019
chore: go mod tidy12ac19d
feat: unexpose WithMaxMemory and WithErrorHandlera3be501
Merge pull request #86 from ggicci/feat/no-runtime-reorder-directivesDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show