Documentation ¶
Index ¶
- Constants
- Variables
- func ToURL(u interface{}) (httpext.URL, error)
- type FileData
- type GlobalHTTP
- type HTTP
- func (h *HTTP) Batch(ctx context.Context, reqsV goja.Value) (goja.Value, error)
- func (*HTTP) CookieJar(ctx context.Context) (*HTTPCookieJar, error)
- func (h *HTTP) Del(ctx context.Context, url goja.Value, args ...goja.Value) (*Response, error)
- func (*HTTP) ExpectedStatuses(ctx context.Context, args ...goja.Value) *expectedStatuses
- func (h *HTTP) File(ctx context.Context, data interface{}, args ...string) FileData
- func (h *HTTP) Get(ctx context.Context, url goja.Value, args ...goja.Value) (*Response, error)
- func (h *HTTP) Head(ctx context.Context, url goja.Value, args ...goja.Value) (*Response, error)
- func (h *HTTP) Options(ctx context.Context, url goja.Value, args ...goja.Value) (*Response, error)
- func (h *HTTP) Patch(ctx context.Context, url goja.Value, args ...goja.Value) (*Response, error)
- func (h *HTTP) Post(ctx context.Context, url goja.Value, args ...goja.Value) (*Response, error)
- func (h *HTTP) Put(ctx context.Context, url goja.Value, args ...goja.Value) (*Response, error)
- func (h *HTTP) Request(ctx context.Context, method string, url goja.Value, args ...goja.Value) (*Response, error)
- func (h *HTTP) SetResponseCallback(ctx context.Context, val goja.Value)
- func (http *HTTP) URL(parts []string, pieces ...string) (httpext.URL, error)
- func (*HTTP) XCookieJar(ctx *context.Context) *HTTPCookieJar
- type HTTPCookieJar
- type Response
Constants ¶
const ( HTTP_METHOD_GET = "GET" HTTP_METHOD_POST = "POST" HTTP_METHOD_PUT = "PUT" HTTP_METHOD_DELETE = "DELETE" HTTP_METHOD_HEAD = "HEAD" HTTP_METHOD_PATCH = "PATCH" HTTP_METHOD_OPTIONS = "OPTIONS" )
Variables ¶
var ErrBatchForbiddenInInitContext = common.NewInitContextError("Using batch in the init context is not supported")
ErrBatchForbiddenInInitContext is used when batch was made in the init context
var ErrHTTPForbiddenInInitContext = common.NewInitContextError("Making http requests in the init context is not supported")
ErrHTTPForbiddenInInitContext is used when a http requests was made in the init context
var ErrJarForbiddenInInitContext = common.NewInitContextError("Making cookie jars in the init context is not supported")
ErrJarForbiddenInInitContext is used when a cookie jar was made in the init context
Functions ¶
Types ¶
type FileData ¶ added in v0.20.0
FileData represents a binary file requiring multipart request encoding
type GlobalHTTP ¶ added in v0.31.0
type GlobalHTTP struct{}
GlobalHTTP is a global HTTP module for a k6 instance/test run
func (*GlobalHTTP) NewModuleInstancePerVU ¶ added in v0.31.0
func (g *GlobalHTTP) NewModuleInstancePerVU() interface{}
NewModuleInstancePerVU returns an HTTP instance for each VU
type HTTP ¶
type HTTP struct { SSL_3_0 string `js:"SSL_3_0"` TLS_1_0 string `js:"TLS_1_0"` TLS_1_1 string `js:"TLS_1_1"` TLS_1_2 string `js:"TLS_1_2"` TLS_1_3 string `js:"TLS_1_3"` OCSP_STATUS_GOOD string `js:"OCSP_STATUS_GOOD"` OCSP_STATUS_REVOKED string `js:"OCSP_STATUS_REVOKED"` OCSP_STATUS_SERVER_FAILED string `js:"OCSP_STATUS_SERVER_FAILED"` OCSP_STATUS_UNKNOWN string `js:"OCSP_STATUS_UNKNOWN"` OCSP_REASON_UNSPECIFIED string `js:"OCSP_REASON_UNSPECIFIED"` OCSP_REASON_KEY_COMPROMISE string `js:"OCSP_REASON_KEY_COMPROMISE"` OCSP_REASON_CA_COMPROMISE string `js:"OCSP_REASON_CA_COMPROMISE"` OCSP_REASON_AFFILIATION_CHANGED string `js:"OCSP_REASON_AFFILIATION_CHANGED"` OCSP_REASON_SUPERSEDED string `js:"OCSP_REASON_SUPERSEDED"` OCSP_REASON_CESSATION_OF_OPERATION string `js:"OCSP_REASON_CESSATION_OF_OPERATION"` OCSP_REASON_CERTIFICATE_HOLD string `js:"OCSP_REASON_CERTIFICATE_HOLD"` OCSP_REASON_REMOVE_FROM_CRL string `js:"OCSP_REASON_REMOVE_FROM_CRL"` OCSP_REASON_PRIVILEGE_WITHDRAWN string `js:"OCSP_REASON_PRIVILEGE_WITHDRAWN"` OCSP_REASON_AA_COMPROMISE string `js:"OCSP_REASON_AA_COMPROMISE"` // contains filtered or unexported fields }
nolint: golint
func (*HTTP) Batch ¶
Batch makes multiple simultaneous HTTP requests. The provideds reqsV should be an array of request objects. Batch returns an array of responses and/or error
func (*HTTP) CookieJar ¶ added in v0.18.0
func (*HTTP) CookieJar(ctx context.Context) (*HTTPCookieJar, error)
func (*HTTP) Del ¶
Del makes an HTTP DELETE and returns a corresponding response by taking goja.Values as arguments
func (*HTTP) ExpectedStatuses ¶ added in v0.31.0
ExpectedStatuses returns expectedStatuses object based on the provided arguments. The arguments must be either integers or object of `{min: <integer>, max: <integer>}` kind. The "integer"ness is checked by the Number.isInteger.
func (*HTTP) Get ¶
Get makes an HTTP GET request and returns a corresponding response by taking goja.Values as arguments
func (*HTTP) Head ¶
Head makes an HTTP HEAD request and returns a corresponding response by taking goja.Values as arguments
func (*HTTP) Options ¶ added in v0.19.0
Options makes an HTTP OPTIONS request and returns a corresponding response by taking goja.Values as arguments
func (*HTTP) Patch ¶
Patch makes a patch request and returns a corresponding response by taking goja.Values as arguments
func (*HTTP) Post ¶
Post makes an HTTP POST request and returns a corresponding response by taking goja.Values as arguments
func (*HTTP) Put ¶
Put makes an HTTP PUT request and returns a corresponding response by taking goja.Values as arguments
func (*HTTP) Request ¶
func (h *HTTP) Request(ctx context.Context, method string, url goja.Value, args ...goja.Value) (*Response, error)
Request makes an http request of the provided `method` and returns a corresponding response by taking goja.Values as arguments
func (*HTTP) SetResponseCallback ¶ added in v0.31.0
SetResponseCallback sets the responseCallback to the value provided. Supported values are expectedStatuses object or a `null` which means that metrics shouldn't be tagged as failed and `http_req_failed` should not be emitted - the behaviour previous to this
func (*HTTP) XCookieJar ¶ added in v0.18.0
func (*HTTP) XCookieJar(ctx *context.Context) *HTTPCookieJar
type HTTPCookieJar ¶ added in v0.18.0
type HTTPCookieJar struct {
// contains filtered or unexported fields
}
HTTPCookieJar is cookiejar.Jar wrapper to be used in js scripts
func (HTTPCookieJar) CookiesForURL ¶ added in v0.18.0
func (j HTTPCookieJar) CookiesForURL(url string) map[string][]string
CookiesForURL return the cookies for a given url as a map of key and values
type Response ¶ added in v0.24.0
Response is a representation of an HTTP response to be returned to the goja VM
func (*Response) ClickLink ¶ added in v0.24.0
ClickLink parses the body as an html, looks for a link and than makes a request as if the link was clicked