core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EditRequestBody

func EditRequestBody(curBody []byte) ([]byte, error)

EditRequestBody edits request body using $EDITOR. If no EDITOR is specified, vim will open.

func FormatResponseBody

func FormatResponseBody(resp History) string

func HeaderMapFromList

func HeaderMapFromList(headerList []string) headerMap

Types

type Controller

type Controller struct {
	Favorites Favorite
	// contains filtered or unexported fields
}

func NewController

func NewController() (*Controller, error)

func (*Controller) SaveFavorite

func (c *Controller) SaveFavorite(request []Request) error

SaveFavorite adds favorite request and save to file

func (*Controller) Send

func (c *Controller) Send(ctx context.Context, method, requestUrl, contentType string, headers headerMap, body []byte) (*History, error)

type Favorite

type Favorite struct {
	Request []Request `toml:"request"`
}

type History

type History struct {
	StatusCode    int
	Header        http.Header
	Body          []byte
	ContentLength int
	ExecutionTime time.Time

	Request  Request
	HttpStat httpstat.Result
}

type Request

type Request struct {
	Method      string
	Url         string
	ContentType string
	Headers     headerMap
	Body        []byte
}

func NewRequest

func NewRequest() *Request

func NewRequestFromCurl

func NewRequestFromCurl(curl *parsecurl.Request) Request

func NewRequestWithValues

func NewRequestWithValues(
	method string,
	url string,
	contentType string,
	headers map[string]string,
	body []byte,
) *Request

func (Request) ToHttpReq

func (r Request) ToHttpReq() *http.Request

Jump to

Keyboard shortcuts

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