Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadSavedRequest ¶
func LoadSavedRequest(rset *RequestSet) (*http.Request, error)
LoadSavedRequest accepts a string from arg in running command as dot.notation. Looks up against the requests.yaml, loads it and searches for the request. The saved request in requests.yaml could be <name>: <url string>. Can also be <name>: {url: <string>, body: <json>, header: {<key>:<value>}} Currently only supports 1 request file and reads whole file - this can be re-visited.
Types ¶
type Auth ¶
type Auth struct { AuthType string `yaml:"authType,omitempty" json:"authType,omitempty"` Token string `yaml:"token,omitempty" json:"token,omitempty"` Username string `yaml:"username,omitempty" json:"username,omitempty"` Password string `yaml:"password,omitempty" json:"password,omitempty"` }
Auth holds the authentication data for building HTTP Auth Headers. Allowed AuthTypes are: Password, Bearer, Token, or empty string If AuthType is passed value of 'Basic' it will be handled as 'Password'
func (*Auth) PasswordAuth ¶
Returns value for Authorization Header as "Basic username:pasword"
type BResponse ¶
type BResponse struct { *http.Response OutBody bytes.Buffer // contains filtered or unexported fields }
func NewBResponse ¶
func NewBResponse() *BResponse
func (*BResponse) StringResponseBody ¶
func (*BResponse) WriteResponse ¶
func (br *BResponse) WriteResponse()
type BResponseCapturer ¶
type BResponseHandler ¶
type BResponseHandler interface { BResponseWriter BResponseCapturer }
type BResponseWriter ¶
type BResponseWriter interface {
WriteResponse()
}
type RequestSet ¶
func (*RequestSet) BodyFile ¶
func (rset *RequestSet) BodyFile(f string) error
Takes path to a file with body for a request. Reads it and attaches to request.
func (*RequestSet) BuildHeader ¶
func (rset *RequestSet) BuildHeader() (*http.Header, error)
Makes a *http.Header from data provided to attach to a http.Request
func (*RequestSet) BuildRequest ¶
func (rset *RequestSet) BuildRequest() (*http.Request, error)
Creates new *http.Request and attaches a *http.Header
func (*RequestSet) Send ¶
func (rset *RequestSet) Send()