httputil

package
v0.48.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoTestHTTP

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

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 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