model

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CONTENT_TYPE_APPLICATION_JSON = "application/json"
View Source
const CONTENT_TYPE_APPLICATION_XML = "application/xml"
View Source
const CONTENT_TYPE_FORM_URLENCODED = "application/x-www-form-urlencoded"
View Source
const CONTENT_TYPE_LUA = "lua"
View Source
const CONTENT_TYPE_MULTIPART_FORM = "multipart/form-data"
View Source
const CONTENT_TYPE_PLAINTEXT = "text/plain"
View Source
const CONTENT_TYPE_STARLARK = "star"
View Source
const CONTENT_TYPE_TEXT_HTML = "text/html"
View Source
const CONTENT_TYPE_YAML = "yaml"
View Source
const HEADER_NAME_AUTHORIZATION = "Authorization"
View Source
const HEADER_NAME_CONTENT_TYPE = "Content-Type"
View Source
const HEADER_VALUE_BASIC_AUTH = "Basic"
View Source
const HEADER_VALUE_BEARER_AUTH = "Bearer"

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Basic  BasicAuth `yaml:"basic_auth"`
	Bearer string    `yaml:"bearer_token"`
}

type BasicAuth

type BasicAuth struct {
	User     string `yaml:"user"`
	Password string `yaml:"password"`
}

type Body

type Body interface{}

type FormData

type FormData interface{}

type HeaderValues

type HeaderValues []string

func (HeaderValues) MarshalYAML

func (headerValues HeaderValues) MarshalYAML() (interface{}, error)

func (*HeaderValues) ToString

func (headerValues *HeaderValues) ToString() string

func (*HeaderValues) UnmarshalYAML

func (headerValues *HeaderValues) UnmarshalYAML(node *yaml.Node) error

type Headers

type Headers map[string]HeaderValues

func (*Headers) ContentType

func (headers *Headers) ContentType() (string, error)

func (*Headers) FromMap

func (headers *Headers) FromMap(m map[string][]string) Headers

func (*Headers) ToMap

func (headers *Headers) ToMap() map[string]string

type Profile

type Profile struct {
	Name              string
	Variables         map[string]string
	Raw               string
	Root              string
	Filename          string
	HasPublicProfile  bool
	HasPrivateProfile bool
}

func (*Profile) AsDotEnv

func (p *Profile) AsDotEnv() string

func (*Profile) DeleteFromFS

func (p *Profile) DeleteFromFS() bool

func (*Profile) IsDefaultPrivateProfile

func (p *Profile) IsDefaultPrivateProfile() bool

func (*Profile) IsDefaultProfile

func (p *Profile) IsDefaultProfile() bool

func (*Profile) IsPrivateProfile

func (p *Profile) IsPrivateProfile() bool

type Request

type Request struct {
	Headers Headers
	Options map[string]interface{}
	Body    Body
	Url     string
	Method  string
	Output  string
}

func (*Request) BodyAsMap

func (r *Request) BodyAsMap() (map[string]string, bool)

func (*Request) ContentType

func (r *Request) ContentType() (string, bool)

func (*Request) HasBodyAsMap

func (r *Request) HasBodyAsMap() bool

func (*Request) IsForm

func (r *Request) IsForm() bool

func (*Request) IsMultipartForm

func (r *Request) IsMultipartForm() bool

type RequestMold

type RequestMold struct {
	Yaml       *YamlRequest
	Scriptable *ScriptableRequest
	Type       string
	Root       string
	Name       string
	Filename   string
}

func (*RequestMold) ChangePreviousReq

func (r *RequestMold) ChangePreviousReq(prevReq string)

* NOTE: assumes previous request is set before; if previous request is not set, this can't add it to the raw versions

func (*RequestMold) Clone

func (r *RequestMold) Clone() RequestMold

func (*RequestMold) DeleteFromFS

func (r *RequestMold) DeleteFromFS() bool

func (*RequestMold) Method

func (r *RequestMold) Method() string

func (*RequestMold) Output

func (r *RequestMold) Output() string

func (*RequestMold) PreviousReq

func (r *RequestMold) PreviousReq() string

func (*RequestMold) Raw

func (r *RequestMold) Raw() string

func (*RequestMold) Url

func (r *RequestMold) Url() string

type Response

type Response struct {
	Headers     map[string]HeaderValues
	Body        []byte
	Status      string
	StatusCode  int
	Proto       string
	Size        int64
	ReceivedAt  time.Time
	Time        time.Duration
	TraceInfo   TraceInfo
	Options     map[string]interface{}
	Request     Request
	RequestName string
}

func (*Response) BodyAsMap

func (r *Response) BodyAsMap() (map[string]interface{}, error)

func (*Response) HeadersAsMapString

func (r *Response) HeadersAsMapString() map[string][]string

type ScriptableRequest

type ScriptableRequest struct {
	Script string
}

type TraceInfo

type TraceInfo struct {
	IsConnReused   bool
	IsConnWasIdle  bool
	DNSLookup      time.Duration
	ConnTime       time.Duration
	TCPConnTime    time.Duration
	TLSHandshake   time.Duration
	ServerTime     time.Duration
	ResponseTime   time.Duration
	TotalTime      time.Duration
	ConnIdleTime   time.Duration
	RequestAttempt int
	RemoteAddr     string
}

type YamlRequest

type YamlRequest struct {
	PrevReq string                 `yaml:"prev_req,omitempty"`
	Url     string                 `yaml:"url"`
	Method  string                 `yaml:"method"`
	Headers Headers                `yaml:"headers,omitempty"`
	Body    Body                   `yaml:"body,omitempty"`
	Output  string                 `yaml:"output,omitempty"`
	Options map[string]interface{} `yaml:"options,omitempty"`
	Raw     string                 `yaml:"raw,omitempty"`
	Auth    Auth                   `yaml:"auth,omitempty"`
}

Jump to

Keyboard shortcuts

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