Documentation ¶
Overview ¶
Package httptest was formerly known as [https://github.com/markbates/willie](https://github.com/markbates/willie). It is used to test HTTP applications easily.
Index ¶
- Constants
- Variables
- type File
- type Handler
- type JSON
- func (r *JSON) Delete() *JSONResponse
- func (r *JSON) Do(method string, body interface{}) (*JSONResponse, error)
- func (r *JSON) Get() *JSONResponse
- func (r *JSON) Patch(body interface{}) *JSONResponse
- func (r *JSON) Perform(req *http.Request) *JSONResponse
- func (r *JSON) Post(body interface{}) *JSONResponse
- func (r *JSON) Put(body interface{}) *JSONResponse
- type JSONResponse
- type Request
- func (r *Request) Delete() *Response
- func (r *Request) Do(method string, body interface{}) (*Response, error)
- func (r *Request) Get() *Response
- func (r *Request) MultiPartPost(body interface{}, files ...File) (*Response, error)
- func (r *Request) MultiPartPut(body interface{}, files ...File) (*Response, error)
- func (r *Request) Perform(req *http.Request) *Response
- func (r *Request) Post(body interface{}) *Response
- func (r *Request) Put(body interface{}) *Response
- func (r *Request) SetBasicAuth(username, password string)
- type Response
- type ResponseRecorder
- type Server
- type XML
- type XMLResponse
Constants ¶
View Source
const DefaultRemoteAddr = httptest.DefaultRemoteAddr
map the std httptest package for ease
View Source
const Version = ""
Variables ¶
View Source
var NewRecorder = httptest.NewRecorder
View Source
var NewRequest = httptest.NewRequest
View Source
var NewServer = httptest.NewServer
View Source
var NewTLSServer = httptest.NewTLSServer
View Source
var NewUnstartedServer = httptest.NewUnstartedServer
Functions ¶
This section is empty.
Types ¶
type JSON ¶
type JSON struct { URL string Headers map[string]string Username string Password string // contains filtered or unexported fields }
func (*JSON) Delete ¶
func (r *JSON) Delete() *JSONResponse
func (*JSON) Do ¶ added in v1.5.0
func (r *JSON) Do(method string, body interface{}) (*JSONResponse, error)
func (*JSON) Get ¶
func (r *JSON) Get() *JSONResponse
func (*JSON) Patch ¶
func (r *JSON) Patch(body interface{}) *JSONResponse
func (*JSON) Post ¶
func (r *JSON) Post(body interface{}) *JSONResponse
func (*JSON) Put ¶
func (r *JSON) Put(body interface{}) *JSONResponse
type JSONResponse ¶
type JSONResponse struct {
*Response
}
func (*JSONResponse) Bind ¶
func (r *JSONResponse) Bind(x interface{})
type Request ¶
type Request struct { URL string Headers map[string]string Username string Password string // contains filtered or unexported fields }
func (*Request) MultiPartPost ¶
func (*Request) MultiPartPut ¶
func (*Request) SetBasicAuth ¶
type ResponseRecorder ¶ added in v1.0.1
type ResponseRecorder = httptest.ResponseRecorder
type XML ¶
type XML struct { URL string Headers map[string]string Username string Password string // contains filtered or unexported fields }
func (*XML) Delete ¶
func (r *XML) Delete() *XMLResponse
func (*XML) Get ¶
func (r *XML) Get() *XMLResponse
func (*XML) Patch ¶
func (r *XML) Patch(body interface{}) *XMLResponse
func (*XML) Post ¶
func (r *XML) Post(body interface{}) *XMLResponse
func (*XML) Put ¶
func (r *XML) Put(body interface{}) *XMLResponse
type XMLResponse ¶
type XMLResponse struct {
*Response
}
func (*XMLResponse) Bind ¶
func (r *XMLResponse) Bind(x interface{})
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
takeon/github.com/ajg/form
Package form implements encoding and decoding of application/x-www-form-urlencoded data.
|
Package form implements encoding and decoding of application/x-www-form-urlencoded data. |
Click to show internal directories.
Click to hide internal directories.