package
0.0.5
Repository: https://github.com/jsautret/genapid.git
Documentation: pkg.go.dev

# README

http

The http predicate does an HTTP request.

Options

OptionRequiredDescription
urlyesURL to call
methodHTTP method (default to GET)
headersheaders to set
paramsURL query params
bodyUse body.string to send a text or body.json to send json.
responseset to JSON to parse the response.
basic_authset basic_auth.username & basic_auth.password

Results

FieldTypeDescription
resultbooleantrue if request was done
responseresponse as string or struct, depending of the response option
typestringContent-Type
codeintreturned 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

# Functions

New returns a new Predicate.

# Variables

Name of the predicate.

# Structs

Predicate is a genapid.Predicate interface that describes the predicate.