httputil

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoTestHTTP

func DoTestHTTP(t *testing.T, data TestDataHTTP)

func DoTestHTTPEx added in v0.57.0

func DoTestHTTPEx[Treq, Tresp any](t *testing.T, data TestDataHTTPEx[Treq, Tresp])

func ProcessError

func ProcessError(w *Writer, err error)

Types

type ChunkedWriter

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

func NewChunkedWriter

func NewChunkedWriter(w http.ResponseWriter) (*ChunkedWriter, error)

func (*ChunkedWriter) Flush

func (w *ChunkedWriter) Flush()

func (*ChunkedWriter) Write

func (w *ChunkedWriter) Write(p []byte) (int, error)

func (*ChunkedWriter) WriteString

func (w *ChunkedWriter) WriteString(data string)

type Error

type Error struct {
	Message string `json:"message"`

} //	@name	UnexpectedError

type TestDataHTTP

type TestDataHTTP struct {
	Req     *http.Request
	Handler http.HandlerFunc

	WantRespBody string
	WantStatus   int
}

type TestDataHTTPEx added in v0.57.0

type TestDataHTTPEx[Treq, Tresp any] struct {
	Method string
	Target string
	Req    Treq

	Handler http.HandlerFunc

	Want    Tresp
	NoResp  bool
	WantErr bool
}

type Writer

type Writer struct {
	http.ResponseWriter
	ErrorMessage string
	StatusCode   int
}

func NewWriter

func NewWriter(w http.ResponseWriter) *Writer

func (*Writer) Error

func (w *Writer) Error(err error, code int)

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(statusCode int)

func (*Writer) WriteJson

func (w *Writer) WriteJson(data any)

Jump to

Keyboard shortcuts

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