Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertHeaderToMap(header http.Header) map[string]interface{}
- func ConvertMapToHeader(m map[string]interface{}) http.Header
- func NewRedirectionHandler(maxRedirect int) func(req *http.Request, via []*http.Request) error
- func SetDefaultHeader(header http.Header, key string, value string) http.Header
- type Client
- type Options
- type Request
- type Response
Constants ¶
View Source
const ( DefaultUserAgent = "Geziyor 1.0" DefaultMaxBody int64 = 1024 * 1024 * 1024 // 1GB DefaultRetryTimes = 2 )
Default values for client
Variables ¶
View Source
var (
DefaultRetryHTTPCodes = []int{500, 502, 503, 504, 522, 524, 408}
)
View Source
var ( // ErrNoCookieJar is the error type for missing cookie jar ErrNoCookieJar = errors.New("cookie jar is not available") )
Functions ¶
func ConvertHeaderToMap ¶
ConvertHeaderToMap converts http.Header to map[string]interface{}
func ConvertMapToHeader ¶
ConvertMapToHeader converts map[string]interface{} to http.Header
func NewRedirectionHandler ¶
NewRedirectionHandler returns maximum allowed redirection function with provided maxRedirect
Types ¶
type Client ¶
Client is a small wrapper around *http.Client to provide new methods.
type Options ¶
type Options struct { MaxBodySize int64 CharsetDetectDisabled bool RetryTimes int RetryHTTPCodes []int RemoteAllocatorURL string AllocatorOptions []chromedp.ExecAllocatorOption }
Options is custom http.client options
type Request ¶
type Request struct { *http.Request // Meta contains arbitrary data. // Use this Meta map to store contextual data between your requests Meta map[string]interface{} // If true, requests will be synchronized Synchronized bool // If true request will be opened in Chrome and // fully rendered HTML DOM response will returned as response Rendered bool // Optional response body encoding. Leave empty for automatic detection. // If you're having issues with auto detection, set this. Encoding string // Set this true to cancel requests. Should be used on middlewares. Cancelled bool // contains filtered or unexported fields }
Request is a small wrapper around *http.Request that contains Metadata and Rendering option
func NewRequest ¶
NewRequest returns a new Request given a method, URL, and optional body.
type Response ¶
type Response struct { *http.Response // Response body Body []byte // Goquery Document object. If response IsHTML, its non-nil. HTMLDoc *goquery.Document Request *Request }
Response type wraps http.Response Contains parsed response data and Geziyor functions.
Click to show internal directories.
Click to hide internal directories.