config

package
v0.0.0-...-af78aa6 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Root            string     `json:"root" validate:"required"`
	Headers         []Header   `json:"headers"`
	Jar             []Cookie   `json:"jar"`
	Endpoints       []Endpoint `json:"endpoints" validate:"min=1,dive"`
	SaveResponseDir string     `json:"saveResponseDir"`
}

func Parse

func Parse(cfgFile string) Config
type Cookie struct {
	Name  string `json:"name" validate:"required"`
	Value string `json:"value" validate:"required"`
}

Cookie Although the struct http.Cookie does exist, it does not contain JSON serialization keys, hence the need for a custom type

type Endpoint

type Endpoint struct {
	Name         string      `json:"name" validate:"required"`
	Path         string      `json:"path" validate:"required"`
	Method       string      `json:"method" validate:"oneof=GET POST PUT HEAD DELETE OPTIONS PATCH"`
	Headers      []Header    `json:"headers"`
	Cookies      []Cookie    `json:"cookies"`
	Jar          []Cookie    `json:"jar"`
	Body         interface{} `json:"body"`
	BodyFile     string      `json:"bodyFile"`
	AcceptStatus []uint16    `json:"acceptStatus" validate:"required"`
	SaveResponse string      `json:"saveResponse"`
	Schema       string      `json:"schema"`
}
type Header struct {
	Key   string `json:"key" validate:"required"`
	Value string `json:"value" validate:"required"`
}

Jump to

Keyboard shortcuts

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