goz: github.com/idoubi/goz Index | Files

package goz

import "github.com/idoubi/goz"


Package Files

goz.go options.go request.go response.go

type Options Uses

type Options struct {
    Debug   bool
    BaseURI string
    Timeout float32

    Query      interface{}
    Headers    map[string]interface{}
    Cookies    interface{}
    FormParams map[string]interface{}
    JSON       interface{}
    Proxy      string
    // contains filtered or unexported fields

Options object

type Request Uses

type Request struct {
    // contains filtered or unexported fields

Request object

func NewClient Uses

func NewClient(opts ...Options) *Request

NewClient new request object

func (*Request) Delete Uses

func (r *Request) Delete(uri string, opts ...Options) (*Response, error)

Delete send delete request

func (*Request) Get Uses

func (r *Request) Get(uri string, opts ...Options) (*Response, error)

Get send get request

func (*Request) Options Uses

func (r *Request) Options(uri string, opts ...Options) (*Response, error)

Options send options request

func (*Request) Patch Uses

func (r *Request) Patch(uri string, opts ...Options) (*Response, error)

Patch send patch request

func (*Request) Post Uses

func (r *Request) Post(uri string, opts ...Options) (*Response, error)

Post send post request

func (*Request) Put Uses

func (r *Request) Put(uri string, opts ...Options) (*Response, error)

Put send put request

func (*Request) Request Uses

func (r *Request) Request(method, uri string, opts ...Options) (*Response, error)

Request send request

type Response Uses

type Response struct {
    // contains filtered or unexported fields

Response response object

func (*Response) GetBody Uses

func (r *Response) GetBody() (ResponseBody, error)

GetBody parse response body

func (*Response) GetHeader Uses

func (r *Response) GetHeader(name string) []string

GetHeader get response header

func (*Response) GetHeaderLine Uses

func (r *Response) GetHeaderLine(name string) string

GetHeaderLine get a single response header

func (*Response) GetHeaders Uses

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

GetHeaders get response headers

func (*Response) GetParsedBody Uses

func (r *Response) GetParsedBody() (*gjson.Result, error)

GetParsedBody parse response body with gjson

func (*Response) GetReasonPhrase Uses

func (r *Response) GetReasonPhrase() string

GetReasonPhrase get response reason phrase

func (*Response) GetRequest Uses

func (r *Response) GetRequest() *http.Request

GetRequest get request object

func (*Response) GetStatusCode Uses

func (r *Response) GetStatusCode() int

GetStatusCode get response status code

func (*Response) HasHeader Uses

func (r *Response) HasHeader(name string) bool

HasHeader get if header exsits in response headers

func (*Response) IsTimeout Uses

func (r *Response) IsTimeout() bool

IsTimeout get if request is timeout

type ResponseBody Uses

type ResponseBody []byte

ResponseBody response body

func (ResponseBody) GetContents Uses

func (r ResponseBody) GetContents() string

GetContents format response body as string

func (ResponseBody) Read Uses

func (r ResponseBody) Read(length int) []byte

Read get slice of response body

func (ResponseBody) String Uses

func (r ResponseBody) String() string

String fmt outout

Package goz imports 15 packages (graph). Updated 2020-09-22. Refresh now. Tools for package owners.