testify

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 4 Imported by: 0

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)

Jump to

Keyboard shortcuts

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