Skip to content

Commit

Permalink
util/decoding: Remove unused pkg functions.
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
  • Loading branch information
philipaconrad committed Jul 22, 2024
1 parent 5e1aa02 commit 01cecba
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions util/decoding/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,17 @@ 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 AddServerDecodingBodyMaxLen(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)
}

func GetServerDecodingBodyMaxLen(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
Expand Down

0 comments on commit 01cecba

Please sign in to comment.