httpreq

package module
v0.0.0-...-fbb06e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

HTTP Request

1 - Create the file example.yml by runnig $ httpreq new example. You'll get the following content:

given:
  https: false
  host: localhost
  port: "8080"
  headers:
    Authorization: Bearer my.awesome.token
then:
- call: POST /api/v1/login
  id: login
  with_headers:
    X-Parameter: magic
  and_send: '{ "email": "{{ .email }}", "password": "{{ .password }}" }'
where:
  email: mr.frodo@lotr.com
  password: $PASSWORD

2 - On another terminal start the echo server with $ httpreq echo;

3 - Then run $ PASSWORD=123456 httpreq exec example.yml;

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(filename string) error

CreateFile ...

func EchoServer

func EchoServer(addr string) error

EchoServer ...

Types

type Config

type Config struct {
	HTTPS  bool              `yaml:"https"`
	Host   string            `yaml:"host"`
	Port   string            `yaml:"port"`
	Header map[string]string `yaml:"headers"`
}

Config ...

type EndpointCall

type EndpointCall struct {
	Call    string            `yaml:"call"`
	ID      string            `yaml:"id"`
	Header  map[string]string `yaml:"with_headers,omitempty"`
	Payload string            `yaml:"and_send"`
}

EndpointCall ...

type Group

type Group struct {
	Config        Config            `yaml:"given"`
	EndpointCalls []EndpointCall    `yaml:"then"`
	Macros        map[string]string `yaml:"where,omitempty"`
}

Group ...

func Parse

func Parse(filename string) (*Group, error)

Parse ...

func (*Group) Execute

func (g *Group) Execute(ids ...string)

Execute ...

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL