Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockResponseWriter ¶
type MockResponseWriter 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() *MockResponseWriter
func (*MockResponseWriter) Header ¶
func (w *MockResponseWriter) Header() http.Header
func (*MockResponseWriter) MustDumpResponse ¶
func (w *MockResponseWriter) MustDumpResponse() []byte
func (*MockResponseWriter) Response ¶
func (w *MockResponseWriter) Response() *http.Response
func (*MockResponseWriter) WriteHeader ¶
func (w *MockResponseWriter) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.