MCPcopy
hub / github.com/gofiber/fiber / Test_Ctx_Range_Overflow

Function Test_Ctx_Range_Overflow

ctx_test.go:5173–5188  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5171}
5172
5173func Test_Ctx_Range_Overflow(t *testing.T) {
5174 t.Parallel()
5175 app := New()
5176 c := app.AcquireCtx(&fasthttp.RequestCtx{})
5177 defer app.ReleaseCtx(c)
5178
5179 tooBig := uint64((math.MaxUint64 >> 1) + 1)
5180
5181 c.Request().Header.Set(HeaderRange, fmt.Sprintf("bytes=%d-100", tooBig))
5182 _, err := c.Range(math.MaxInt64)
5183 require.ErrorIs(t, err, ErrRangeMalformed)
5184
5185 c.Request().Header.Set(HeaderRange, fmt.Sprintf("bytes=0-%d", tooBig))
5186 _, err = c.Range(math.MaxInt64)
5187 require.ErrorIs(t, err, ErrRangeMalformed)
5188}
5189
5190func Test_Ctx_Range_Unsatisfiable(t *testing.T) {
5191 t.Parallel()

Callers

nothing calls this directly

Calls 6

AcquireCtxMethod · 0.80
ReleaseCtxMethod · 0.80
NewFunction · 0.70
SetMethod · 0.65
RequestMethod · 0.65
RangeMethod · 0.65

Tested by

no test coverage detected