Internal

internal/sizedstream

import "github.com/gofiber/fiber/v3/internal/sizedstream"

Package sizedstream buffers a body stream within a length: the one a response declares, or a request's limit.

Functions

func Read(resp *fasthttp.Response, n int) bool

Source: internal/sizedstream/sizedstream.go:101

Read reads the body stream of resp, which declares n bytes, into its body and reports whether exactly n arrived without error. Response.Body reads to the end and keeps a read error as the body.

func ReadRequest(req *fasthttp.Request, limit int) error

Source: internal/sizedstream/sizedstream.go:124

ReadRequest reads the body stream of req into its body, failing with fasthttp.ErrBodyTooLarge past limit or with the stream's own error, which Request.Body would keep as the body. A client's declared length is not presized for.