airazor

package module
v0.0.0-...-78ff08a Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: BSD-3-Clause Imports: 16 Imported by: 0

README

Airezor

A small program to try to test a Rest API. The name come fram Transformers.

I found a better alternative, use https://deno.com/ with unit test, so I stop development of this project.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorization

type Authorization struct {
	None   bool                `json:"none,omitempty"`
	Basic  *AuthorizationBasic `json:"basic,omitempty"`
	Bearer string              `json:"bearer,omitempty"`
	Raw    string              `json:"raw,omitempty"`
	JWT    *AuthorizationJWT   `json:"jwt,omitempty"`
}

One of the following fields

func (*Authorization) Header

func (auth *Authorization) Header(now time.Time) string

Generate the string to be used in HTTP headers. If the authentification is not defined,

type AuthorizationBasic

type AuthorizationBasic struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

type AuthorizationJWT

type AuthorizationJWT struct {
	Jose map[string]any `json:"jose"`
	Body map[string]any `json:"body"`

	// Possibles values: HS256|HS384|HS512
	// Other value will produce a none algo signature
	Algo string `json:"algo"`

	// One the the floowing value, use .Key() to gte the value
	KeyBytes  []byte `json:"key-base64"`
	KeyString string `json:"key-string"`
}

func (*AuthorizationJWT) Key

func (jwt *AuthorizationJWT) Key() []byte

type Collection

type Collection struct {
	Name string `json:"name"`

	*Authorization `json:"authorization,omitempty"`

	Requests []*Request    `json:"requests"`
	Children []*Collection `json:"children"`
	// contains filtered or unexported fields
}

func ParseCollection

func ParseCollection(data []byte) (*Collection, error)

func (*Collection) Fetch

func (c *Collection) Fetch(config *Config)

func (*Collection) RemoveResponse

func (c *Collection) RemoveResponse()

Remove all response object of all requests.

type Config

type Config struct {
	Context context.Context
	http.RoundTripper
	LimitBody int64
}

type Request

type Request struct {
	Name string `json:"name,omitempty"`

	*Authorization `json:"authorization,omitempty"`

	Method string      `json:"method,omitempty"`
	URL    string      `json:"url,omitempty"`
	Header http.Header `json:"header,omitempty"`
	Body   string      `json:"body,omitempty"`

	Test string `json:"test,omitempty"`

	Error    string    `json:"error,omitempty"`
	Response *Response `json:"response,omitempty"`
	// contains filtered or unexported fields
}

func (*Request) Fetch

func (request *Request) Fetch(config *Config) error

type Response

type Response struct {
	StatusCode int         `json:"statusCode"`
	Header     http.Header `json:"header"`
	Body       []byte      `json:"body"`
	TestFails  []string    `json:"testFails"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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