request

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client struct contains reference to internal http client

func NewClient

func NewClient(opts *ClientOptions) *Client

NewClient method returns a pointer to the Client

func (*Client) Request

func (c *Client) Request(opts *RequestOptions) (*Response, error)

Request method will make a request

type ClientOptions

type ClientOptions struct {
	Timeout int
}

ClientOptions struct contains options for HTTP Client which will be long lived client

type Device

type Device struct {
	Type, Browser string
	OS, OSName    string
	OSVersion     string
}

Device struct returns the information about the device by parsing the user agent

func ParseUA

func ParseUA(ua string) *Device

ParseUA function returns a device struct containing the parsed user agent info

type RequestOptions

type RequestOptions struct {
	Method  string
	URL     string
	Body    string
	Retries int
	Query   map[string]string
	Headers map[string]string

	RetryInterval time.Duration // retry after x milliseconds
}

RequestOptions struct

type Response

type Response struct {
	Body, Status string
	StatusCode   int
	Header       map[string][]string
	Cookies      []*netHttp.Cookie
	Latency      int64
	Retries      int
}

Response struct

Jump to

Keyboard shortcuts

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