httptest: github.com/gobuffalo/httptest Index | Files

package httptest

import "github.com/gobuffalo/httptest"

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

Package Files

file.go httptest.go json.go request.go response.go version.go xml.go

Constants

const DefaultRemoteAddr = httptest.DefaultRemoteAddr

map the std httptest package for ease

const Version = "v1.0.4"

Variables

var NewRecorder = httptest.NewRecorder
var NewRequest = httptest.NewRequest
var NewServer = httptest.NewServer
var NewTLSServer = httptest.NewTLSServer
var NewUnstartedServer = httptest.NewUnstartedServer

type File Uses

type File struct {
    io.Reader
    ParamName string
    FileName  string
}

type Handler Uses

type Handler struct {
    http.Handler
    Cookies    string
    Headers    map[string]string
    HmaxSecret string
}

func New Uses

func New(h http.Handler) *Handler

func (*Handler) HTML Uses

func (w *Handler) HTML(u string, args ...interface{}) *Request

func (*Handler) JSON Uses

func (w *Handler) JSON(u string, args ...interface{}) *JSON

func (*Handler) XML Uses

func (w *Handler) XML(u string, args ...interface{}) *XML

type JSON Uses

type JSON struct {
    URL string

    Headers  map[string]string
    Username string
    Password string
    // contains filtered or unexported fields
}

func (*JSON) Delete Uses

func (r *JSON) Delete() *JSONResponse

func (*JSON) Get Uses

func (r *JSON) Get() *JSONResponse

func (*JSON) Patch Uses

func (r *JSON) Patch(body interface{}) *JSONResponse

func (*JSON) Post Uses

func (r *JSON) Post(body interface{}) *JSONResponse

func (*JSON) Put Uses

func (r *JSON) Put(body interface{}) *JSONResponse

type JSONResponse Uses

type JSONResponse struct {
    *Response
}

func (*JSONResponse) Bind Uses

func (r *JSONResponse) Bind(x interface{})

type Request Uses

type Request struct {
    URL string

    Headers  map[string]string
    Username string
    Password string
    // contains filtered or unexported fields
}

func (*Request) Delete Uses

func (r *Request) Delete() *Response

func (*Request) Get Uses

func (r *Request) Get() *Response

func (*Request) MultiPartPost Uses

func (r *Request) MultiPartPost(body interface{}, files ...File) (*Response, error)

func (*Request) MultiPartPut Uses

func (r *Request) MultiPartPut(body interface{}, files ...File) (*Response, error)

func (*Request) Post Uses

func (r *Request) Post(body interface{}) *Response

func (*Request) Put Uses

func (r *Request) Put(body interface{}) *Response

func (*Request) SetBasicAuth Uses

func (r *Request) SetBasicAuth(username, password string)

type Response Uses

type Response struct {
    *httptest.ResponseRecorder
}

func (*Response) CloseNotify Uses

func (r *Response) CloseNotify() <-chan bool

func (*Response) Location Uses

func (r *Response) Location() string

type ResponseRecorder Uses

type ResponseRecorder = httptest.ResponseRecorder

type Server Uses

type Server = httptest.Server

type XML Uses

type XML struct {
    URL string

    Headers map[string]string
    // contains filtered or unexported fields
}

func (*XML) Delete Uses

func (r *XML) Delete() *XMLResponse

func (*XML) Get Uses

func (r *XML) Get() *XMLResponse

func (*XML) Patch Uses

func (r *XML) Patch(body interface{}) *XMLResponse

func (*XML) Post Uses

func (r *XML) Post(body interface{}) *XMLResponse

func (*XML) Put Uses

func (r *XML) Put(body interface{}) *XMLResponse

type XMLResponse Uses

type XMLResponse struct {
    *Response
}

func (*XMLResponse) Bind Uses

func (r *XMLResponse) Bind(x interface{})

Package httptest imports 14 packages (graph) and is imported by 1 packages. Updated 2018-12-11. Refresh now. Tools for package owners.