Help us shape the future of Go! Take the 2026 Go Developer Survey

resp

package
v0.10.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 17 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReadBodyStream = ReadHeaderBodyStream

Deprecated: use ReadHeaderBodyStream

Functions

func ConnectionUpgrade

func ConnectionUpgrade(h *protocol.ResponseHeader) bool

ConnectionUpgrade returns true if 'Connection: Upgrade' header is set.

func GetHTTP1Response

func GetHTTP1Response(resp *protocol.Response) fmt.Stringer

func NewChunkedBodyWriter added in v0.6.0

func NewChunkedBodyWriter(r *protocol.Response, w network.Writer) network.ExtWriter

NewChunkedBodyWriter creates a new chunked body writer.

func Read

func Read(resp *protocol.Response, r network.Reader) error

Read reads response (including body) from the given r.

io.EOF is returned if r is closed before reading the first header byte.

func ReadHeader

func ReadHeader(h *protocol.ResponseHeader, r network.Reader) error

Read reads response header from r.

io.EOF is returned if r is closed before reading the first header byte.

func ReadHeaderAndLimitBody

func ReadHeaderAndLimitBody(resp *protocol.Response, r network.Reader, maxBodySize int) error

ReadHeaderAndLimitBody ...

func ReadHeaderBodyStream added in v0.10.0

func ReadHeaderBodyStream(resp *protocol.Response, r network.Reader,
	maxBodySize int, closeCallBack func(shouldClose bool) error) error

ReadHeaderBodyStream ...

func ReadHeaders added in v0.10.0

func ReadHeaders(resp *protocol.Response, r network.Reader) error

ReadHeaders reads http header into *protocol.Response

func ReadRespBody added in v0.10.0

func ReadRespBody(resp *protocol.Response, r network.Reader, maxBodySize int) (err error)

ReadRespBody reads response body from the given r, limiting the body size.

If maxBodySize > 0 and the body size exceeds maxBodySize, then ErrBodyTooLarge is returned.

io.EOF is returned if r is closed before reading the first header byte.

func ReadRespBodyStream added in v0.10.0

func ReadRespBodyStream(resp *protocol.Response, r network.Reader,
	maxBodySize int, closeCallBack func(shouldClose bool) error) (err error)

ReadRespBodyStream reads response body in stream

func Write

func Write(resp *protocol.Response, w network.Writer) error

Write writes response to w.

Write doesn't flush response to w for performance reasons.

See also WriteTo.

func WriteHeader

func WriteHeader(h *protocol.ResponseHeader, w network.Writer) error

WriteHeader writes response header to w.

Types

type ErrBodyStreamWritePanic

type ErrBodyStreamWritePanic struct {
	// contains filtered or unexported fields
}

ErrBodyStreamWritePanic is returned when panic happens during writing body stream.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL