response

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package response contains common utilities for handling HTTP responses.

nolint: mnd

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONError

func JSONError(w http.ResponseWriter, err error, statusCode int)

JSONError will set the status code and a write a standardized error message to the response writer.

func NewBodyWrapper

func NewBodyWrapper(body io.ReadCloser) io.ReadCloser

func NewResponseWrapper

func NewResponseWrapper(responseWriter http.ResponseWriter) http.ResponseWriter

Types

type BodyWrapper

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

func (*BodyWrapper) Close

func (bw *BodyWrapper) Close() error

func (*BodyWrapper) NumBytes

func (bw *BodyWrapper) NumBytes() int64

func (*BodyWrapper) Read

func (bw *BodyWrapper) Read(p []byte) (int, error)

type Wrapper

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

func (*Wrapper) Flush

func (r *Wrapper) Flush()

func (*Wrapper) GetRequestContext

func (r *Wrapper) GetRequestContext() context.Context

func (*Wrapper) Header

func (r *Wrapper) Header() http.Header

func (*Wrapper) NumBytes

func (r *Wrapper) NumBytes() int64

func (*Wrapper) RealResponseWriter

func (r *Wrapper) RealResponseWriter() http.ResponseWriter

func (*Wrapper) SetRequestContext

func (r *Wrapper) SetRequestContext(ctx context.Context)

func (*Wrapper) SpanStatus

func (r *Wrapper) SpanStatus() (codes.Code, string)

func (*Wrapper) StatusCode

func (r *Wrapper) StatusCode() int

func (*Wrapper) Write

func (r *Wrapper) Write(p []byte) (int, error)

func (*Wrapper) WriteHeader

func (r *Wrapper) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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