src

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENVKEY   = 0
	ENVVALUE = 1
)
View Source
const (
	METHOD             = 0
	URL                = 1
	PROTOCOL           = 2
	NAME               = 0
	VALUE              = 1
	FILE_EMBED_TAG     = 0
	FILE_EMBED         = 1
	MULTIPART_FORM_TAG = 0
	MULTIPART_NAME     = 1
	MULTIPART_VALUE    = 2
	KEY                = 0
)

Variables

View Source
var LOADING_CHARS = [...]string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}

Functions

func ClearSpinner added in v0.3.3

func ClearSpinner()

func FormatBody

func FormatBody(body []byte, mediaType string) ([]byte, error)

func FormatFileEmbed added in v0.3.4

func FormatFileEmbed(fileEmbed string) []byte

func FormatFilePathsTitle

func FormatFilePathsTitle() string

func FormatHeaders

func FormatHeaders(headers http.Header, directionCharacter string) []byte

func FormatMultiPart added in v0.3.4

func FormatMultiPart(multipartItems []MultiPartItem, boundary string) ([]byte, error)

func FormatRequestLine

func FormatRequestLine(req http.Request) []byte

func FormatStatusLine

func FormatStatusLine(res http.Response) string

func PrettifyJson added in v0.3.5

func PrettifyJson(j []byte) ([]byte, error)

func PrintSpinner added in v0.3.3

func PrintSpinner(i int)

func PrintWarning

func PrintWarning(err error)

func WaitForHttpRequest added in v0.3.3

func WaitForHttpRequest(req *http.Request) (*http.Response, error)

func WriteMultipart added in v0.3.4

func WriteMultipart(h HurlFile, writer *multipart.Writer) error

Types

type HurlConfig added in v0.2.8

type HurlConfig struct {
	Version        bool
	Verbose        bool
	BodyOutputPath string
}

func InitConfig

func InitConfig() (HurlConfig, error)

type HurlFile

type HurlFile struct {
	Method            string
	URL               url.URL
	Headers           map[string]string
	Body              []byte
	FileEmbed         string
	MultipartFormData []MultiPartItem
	MultipartBoundary string

	// CLI and hurl.json options
	Config HurlConfig
}

func ParseHurlFile

func ParseHurlFile(r io.Reader) (*HurlFile, error)

func (*HurlFile) NewRequest

func (h *HurlFile) NewRequest() (*http.Request, error)

type HurlOutput

type HurlOutput struct {
	Config HurlConfig
}

func (HurlOutput) OutputRequest

func (h HurlOutput) OutputRequest(hurlFile *HurlFile, req http.Request) error

func (HurlOutput) OutputResponse

func (h HurlOutput) OutputResponse(res http.Response) error

type MultiPartItem added in v0.3.4

type MultiPartItem struct {
	Name       string
	IsFilePath bool
	Value      string
}

Jump to

Keyboard shortcuts

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