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

Function Test_Ctx_Range_Unsatisfiable

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

Source from the content-addressed store, hash-verified

5188}
5189
5190func Test_Ctx_Range_Unsatisfiable(t *testing.T) {
5191 t.Parallel()
5192 app := New()
5193 app.Get("/", func(c Ctx) error {
5194 _, err := c.Range(10)
5195 if err != nil {
5196 return err
5197 }
5198 return c.SendString("ok")
5199 })
5200
5201 req := httptest.NewRequest(MethodGet, "http://example.com/", http.NoBody)
5202 req.Header.Set(HeaderRange, "bytes=20-30")
5203 resp, err := app.Test(req)
5204 require.NoError(t, err)
5205 require.Equal(t, StatusRequestedRangeNotSatisfiable, resp.StatusCode)
5206 require.Equal(t, "bytes */10", resp.Header.Get(HeaderContentRange))
5207}
5208
5209func Test_Ctx_Range_TooManyRanges(t *testing.T) {
5210 t.Parallel()

Callers

nothing calls this directly

Calls 6

TestMethod · 0.80
NewFunction · 0.70
GetMethod · 0.65
RangeMethod · 0.65
SendStringMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected