Documentation
¶
Index ¶
- Constants
- func Bearer(token string) auth.RTComposer
- func Form(m map[string]any) (ret url.Values)
- func Gopt_App_Main(app interface{ ... }, workers ...interface{ initCase(*App, CaseT) })
- func Gopt_App_TestMain(app interface{ ... }, m *testing.M)
- func Gopt_CaseApp_TestMain(c interface{ ... }, t *testing.T)
- func JsonEncode(v any) string
- type App
- type Case
- func (p *Case) DELETE(url string) *Request
- func (p *Case) GET(url string) *Request
- func (p *Case) Get(url string) *Request
- func (p *Case) HEAD(url string) *Request
- func (p *Case) Head(url string) *Request
- func (p *Case) OPTIONS(url string) *Request
- func (p *Case) Options(url string) *Request
- func (p *Case) PATCH(url string) *Request
- func (p *Case) POST(url string) *Request
- func (p *Case) PUT(url string) *Request
- func (p *Case) Patch(url string) *Request
- func (p *Case) Post(url string) *Request
- func (p *Case) Put(url string) *Request
- func (p *Case) Req__0(method, url string) *Request
- func (p *Case) Req__1() *Request
- func (p *Case) T() CaseT
- type CaseApp
- type CaseT
- type Request
- func (p *Request) Auth(auth auth.RTComposer) *Request
- func (p *Request) Binary(body any) *Request
- func (p *Request) Body(bodyType string, body any) *Request
- func (p *Request) Form(body any) *Request
- func (p *Request) Header__0(key string, value any) *Request
- func (p *Request) Header__1() http.Header
- func (p *Request) Json(body any) *Request
- func (p *Request) Resp() *Response
- func (p *Request) RetWith(code any) *Request
- func (p *Request) Send() *Request
- func (p *Request) Text(body any) *Request
- func (p *Request) WithBinary(bodyType string, body []byte) *Request
- func (p *Request) WithBody(bodyType string, body RequestBody) *Request
- func (p *Request) WithBodyEx(bodyType string, body any) *Request
- func (p *Request) WithForm(body url.Values) *Request
- func (p *Request) WithFormEx(body any) *Request
- func (p *Request) WithHeader(key string, value any) *Request
- func (p *Request) WithJson(body any) *Request
- func (p *Request) WithText(bodyType, body string) *Request
- type RequestBody
- type Response
Constants ¶
const ( GopPackage = "github.com/goplus/yap/test" GopTestClass = true )
const (
Gopo_Request_Ret = ".Send,.RetWith"
)
Variables ¶
This section is empty.
Functions ¶
func Bearer ¶ added in v0.7.3
func Bearer(token string) auth.RTComposer
Bearer creates a Bearer Authorization by specified token.
func Gopt_App_Main ¶
Gopt_App_Main is required by Go+ compiler as the Main entry of a YAP testing project.
func Gopt_App_TestMain ¶ added in v0.7.2
Gopt_App_TestMain is required by Go+ compiler as the TestMain entry of a YAP testing project.
func Gopt_CaseApp_TestMain ¶ added in v0.8.1
Gopt_CaseApp_TestMain is required by Go+ compiler as the entry of a YAP test case.
func JsonEncode ¶
JsonEncode encodes a value into string in json format.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) Host ¶ added in v0.7.2
Host replaces a host into real. For example:
host "https://example.com" "http://localhost:8080" host "http://example.com" "http://localhost:8888"
func (*App) RunTestServer ¶ added in v0.7.3
RunTestServer runs a HTTP server by httptest.Server.
type Case ¶
type Case struct { *Request test.Case DefaultHeader http.Header // contains filtered or unexported fields }
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) Auth ¶
func (p *Request) Auth(auth auth.RTComposer) *Request
Auth sets an Authorization for this request.
func (*Request) Body ¶
Body sets request body for this request (if request is not sended), or matches response body of this request (after response is returned). Here body can be: string, Var(string), []byte, RequestBody.
func (*Request) Header__0 ¶ added in v0.7.3
Header sets a Header for this request (if request is not sended), or matches a Header for response of this request (after response is returned). Here value can be: string, []string, Var(string), Var([]string).
func (*Request) Json ¶
body can be:
- map[string]any, Var(map[string]any), []any, Var([]any),
- []string, Var([]string), string, Var(string), int, Var(int),
- bool, Var(bool), float64, Var(float64).
func (*Request) WithFormEx ¶
func (*Request) WithHeader ¶
WithHeader sets a Header for this request.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}