chore(deps): bump github.com/open-policy-agent/opa from 0.65.0 to 0.67.1
Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 0.65.0 to 0.67.1. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v0.65.0...v0.67.1) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
a381a3a0e8
commit
4d155475fe
+31
@@ -0,0 +1,31 @@
|
||||
package decoding
|
||||
|
||||
import "context"
|
||||
|
||||
type requestContextKey string
|
||||
|
||||
// Note(philipc): We can add functions later to add the max request body length
|
||||
// to contexts, if we ever need to.
|
||||
const (
|
||||
reqCtxKeyMaxLen = requestContextKey("server-decoding-plugin-context-max-length")
|
||||
reqCtxKeyGzipMaxLen = requestContextKey("server-decoding-plugin-context-gzip-max-length")
|
||||
)
|
||||
|
||||
func AddServerDecodingMaxLen(ctx context.Context, maxLen int64) context.Context {
|
||||
return context.WithValue(ctx, reqCtxKeyMaxLen, maxLen)
|
||||
}
|
||||
|
||||
func AddServerDecodingGzipMaxLen(ctx context.Context, maxLen int64) context.Context {
|
||||
return context.WithValue(ctx, reqCtxKeyGzipMaxLen, maxLen)
|
||||
}
|
||||
|
||||
// Used for enforcing max body content limits when dealing with chunked requests.
|
||||
func GetServerDecodingMaxLen(ctx context.Context) (int64, bool) {
|
||||
maxLength, ok := ctx.Value(reqCtxKeyMaxLen).(int64)
|
||||
return maxLength, ok
|
||||
}
|
||||
|
||||
func GetServerDecodingGzipMaxLen(ctx context.Context) (int64, bool) {
|
||||
gzipMaxLength, ok := ctx.Value(reqCtxKeyGzipMaxLen).(int64)
|
||||
return gzipMaxLength, ok
|
||||
}
|
||||
Reference in New Issue
Block a user