fire

package module
Version: v0.0.0-...-6c239dc Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 7 Imported by: 0

README

fire - send http requests

Send HTTP requests

go report card Build Status MIT license GoDoc

build

make

if not using upx run

make build

the binary is generated in ./bin/

usage

define requests in a JSON file

[
    {
        "METHOD": "GET",
        "URL": "http://www.prillwitz.io",
        "AUTH": {
            "username": "",
            "password": ""
        },
        "HEADERS": {
            "User-Agent": "fire"
        },        
        "PAYLOAD": {
            "block": "true"
        }
    }
]

Run

fire ./path/to/requests.json

Output

REQUEST:        [GET]   http://www.prillwitz.io?block=true
HEADERS:        {"User-Agent":["fire"]}
PAYLOAD:        null
RESPONSE:       503

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSupportedMethod

func IsSupportedMethod(check string) bool

IsSupportedMethod checks if the passed `check` string is a valid method. The function uses a static map containing the known/supported methods for validation.

func IsValidURL

func IsValidURL(check string) bool

IsValidURL checks if the passed `check` string is a valid URI. This function uses the url.ParseRequestURI function for validation.

Types

type Request

type Request struct {
	Method    string            `json:"METHOD"`
	URL       string            `json:"URL"`
	Headers   map[string]string `json:"HEADERS"`
	Payload   map[string]string `json:"PAYLOAD"`
	Auth      map[string]string `json:"AUTH"`
	Timestamp int64
	Response  *Response
}

Request stores information about a request. If the request is executed/fired, the response result is added to the request.

func (*Request) Fire

func (r *Request) Fire() (*Response, error)

Fire executes the request.

type Response

type Response struct {
	*http.Response
	Timestamp int64
	Duration  int64
}

Response holds information about the http.Response, the Timestamp and the Duration. The Duration is calculated by the Requests Timestamp and the Response Timestamp

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL