response

package
v0.0.0-...-4590e31 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHeaderOnceResponseWriter

func NewHeaderOnceResponseWriter(w http.ResponseWriter) http.ResponseWriter

NewHeaderOnceResponseWriter returns a HeaderOnceResponseWriter.

Types

type HeaderOnceResponseWriter

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

HeaderOnceResponseWriter is a http.ResponseWriter implementation that only the first WriterHeader takes effect.

func (*HeaderOnceResponseWriter) Flush

func (w *HeaderOnceResponseWriter) Flush()

Flush flushes the response writer.

func (*HeaderOnceResponseWriter) Header

func (w *HeaderOnceResponseWriter) Header() http.Header

Header returns the http header.

func (*HeaderOnceResponseWriter) Hijack

Hijack implements the http.Hijacker interface. This expands the Response to fulfill http.Hijacker if the underlying http.ResponseWriter supports it.

func (*HeaderOnceResponseWriter) Write

func (w *HeaderOnceResponseWriter) Write(bytes []byte) (int, error)

Write writes bytes into w.

func (*HeaderOnceResponseWriter) WriteHeader

func (w *HeaderOnceResponseWriter) WriteHeader(code int)

WriteHeader writes code into w, and not sealing the writer.

type WithCodeResponseWriter

type WithCodeResponseWriter struct {
	Writer http.ResponseWriter
	Code   int
}

A WithCodeResponseWriter is a helper to delay sealing a http.ResponseWriter on writing code.

func NewWithCodeResponseWriter

func NewWithCodeResponseWriter(writer http.ResponseWriter) *WithCodeResponseWriter

NewWithCodeResponseWriter returns a WithCodeResponseWriter. If writer is already a WithCodeResponseWriter, it returns writer directly.

func (*WithCodeResponseWriter) Flush

func (w *WithCodeResponseWriter) Flush()

Flush flushes the response writer.

func (*WithCodeResponseWriter) Header

func (w *WithCodeResponseWriter) Header() http.Header

Header returns the http header.

func (*WithCodeResponseWriter) Hijack

Hijack implements the http.Hijacker interface. This expands the Response to fulfill http.Hijacker if the underlying http.ResponseWriter supports it.

func (*WithCodeResponseWriter) Write

func (w *WithCodeResponseWriter) Write(bytes []byte) (int, error)

Write writes bytes into w.

func (*WithCodeResponseWriter) WriteHeader

func (w *WithCodeResponseWriter) WriteHeader(code int)

WriteHeader writes code into w, and not sealing the writer.

Jump to

Keyboard shortcuts

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