Documentation ¶
Index ¶
- func NewHeaderOnceResponseWriter(w http.ResponseWriter) http.ResponseWriter
- type HeaderOnceResponseWriter
- func (w *HeaderOnceResponseWriter) Flush()
- func (w *HeaderOnceResponseWriter) Header() http.Header
- func (w *HeaderOnceResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (w *HeaderOnceResponseWriter) Write(bytes []byte) (int, error)
- func (w *HeaderOnceResponseWriter) WriteHeader(code int)
- type WithCodeResponseWriter
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 ¶
func (w *HeaderOnceResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
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 ¶ added in v1.5.4
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 ¶
func (w *WithCodeResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
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.