Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultRemoteAddr = "1.2.3.4"
DefaultRemoteAddr is the default remote address to return in RemoteAddr if an explicit DefaultRemoteAddr isn't set on FailingResponseRecorder.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FailingResponseRecorder ¶
type FailingResponseRecorder struct { // Code is the HTTP response code set by WriteHeader. // // Note that if a Handler never calls WriteHeader or Write, // this might end up being 0, rather than the implicit // http.StatusOK. To get the implicit value, use the Result // method. Code int // HeaderMap contains the headers explicitly set by the Handler. // // To get the implicit headers set by the server (such as // automatic Content-Type), use the Result method. HeaderMap http.Header // Flushed is whether the Handler called Flush. Flushed bool // contains filtered or unexported fields }
FailingResponseRecorder is an implementation of http.ResponseWriter that causes an error when the body is being written. Headers are ok.
func NewFailingRecorder ¶
func NewFailingRecorder() *FailingResponseRecorder
NewFailingRecorder returns an initialized FailingResponseRecorder.
func (*FailingResponseRecorder) Flush ¶
func (rw *FailingResponseRecorder) Flush()
Flush sets rw.Flushed to true.
func (*FailingResponseRecorder) Header ¶
func (rw *FailingResponseRecorder) Header() http.Header
Header returns the response headers.
func (*FailingResponseRecorder) Write ¶
func (rw *FailingResponseRecorder) Write(buf []byte) (int, error)
Write always errors out.
func (*FailingResponseRecorder) WriteHeader ¶
func (rw *FailingResponseRecorder) WriteHeader(code int)
WriteHeader sets rw.Code. After it is called, changing rw.Header will not affect rw.HeaderMap.
func (*FailingResponseRecorder) WriteString ¶
func (rw *FailingResponseRecorder) WriteString(str string) (int, error)
WriteString always errors after writing the header.
Click to show internal directories.
Click to hide internal directories.