package
Version:
v0.0.5
Opens a new window with list of versions in this module.
Published: Apr 2, 2021
License: Apache-2.0
Opens a new window with license information.
Imports: 11
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
http
The http
predicate does an HTTP request.
Options
Option |
Required |
Description |
url |
yes |
URL to call |
method |
|
HTTP method (default to GET) |
headers |
|
headers to set |
params |
|
URL query params |
body |
|
Use body.string to send a text or body.json to send json. |
response |
|
set to JSON to parse the response. |
basic_auth |
|
set basic_auth.username & basic_auth.password |
Results
Field |
Type |
Description |
result |
boolean |
true if request was done |
response |
|
response as string or struct, depending of the response option |
type |
string |
Content-Type |
code |
int |
returned HTTP code |
Example:
http:
url: http://test/params
method: post
body:
json:
k1: v1
k2: v2
response: json
basic_auth:
username: myuser
password: mypasswd
params:
k1: v1
k2: v2
headers:
h1: v1
h2: v2
Documentation
¶
New returns a new Predicate
type Predicate struct {
}
Predicate is a genapid.Predicate interface that describes the predicate
Call evaluates the predicate
Name returns the name of the predicate
func (predicate *Predicate) Params() interface{}
Params returns a reference to a struct params accepted by the predicate
Result returns data set by the predicate
Source Files
¶
Click to show internal directories.
Click to hide internal directories.