Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseWriter ¶
type ResponseWriter struct { StatusCode int bytes.Buffer // contains filtered or unexported fields }
Example ¶
rw := NewMockResponseWriter() rw.Header().Set("Content-Type", "application/json") rw.WriteHeader(http.StatusOK) rw.Write([]byte(`{"status":"ok"}`)) fmt.Println(string(rw.MustDumpResponse()))
Output: HTTP/0.0 200 OK Content-Type: application/json {"status":"ok"}
func NewMockResponseWriter ¶
func NewMockResponseWriter() *ResponseWriter
func (*ResponseWriter) Header ¶
func (w *ResponseWriter) Header() http.Header
func (*ResponseWriter) MustDumpResponse ¶
func (w *ResponseWriter) MustDumpResponse() []byte
func (*ResponseWriter) Response ¶
func (w *ResponseWriter) Response() *http.Response
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.