types

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChromeDPTasks

type ChromeDPTasks struct {
	Tasks chromedp.Tasks

	UserAgentHeader network.Headers

	ResponseMeta     *ResponseMeta
	DebugHeaderValue string
}

ChromeDPTasks is a type wrapper for the chromedp.Tasks.

func (*ChromeDPTasks) IsRequest

func (r *ChromeDPTasks) IsRequest()

type GoHTTPRequest

type GoHTTPRequest struct {
	Req *http.Request

	DebugHeaderValue string
}

GoHTTPRequest is a type wrapper for the *http.Request.

func (*GoHTTPRequest) IsRequest

func (r *GoHTTPRequest) IsRequest()

type GoHTTPResponse

type GoHTTPResponse struct {
	Resp *http.Response
}

GoHTTPResponse is a wrapper that provides implementation of the Response interface for the *http.Response.

func (*GoHTTPResponse) GetContent

func (r *GoHTTPResponse) GetContent() []byte

func (*GoHTTPResponse) GetError

func (r *GoHTTPResponse) GetError() error

func (*GoHTTPResponse) GetHeaders

func (r *GoHTTPResponse) GetHeaders() http.Header

func (*GoHTTPResponse) GetReason

func (r *GoHTTPResponse) GetReason() string

func (*GoHTTPResponse) GetStatusCode

func (r *GoHTTPResponse) GetStatusCode() int

type HTTPClientType

type HTTPClientType int

HTTPClientType represents the type of HTTP client.

const (
	// GoHTTPClient indicates that the standard Go HTTP client is used.
	GoHTTPClient HTTPClientType = iota

	// ChromeHTTPClient indicates that a Chrome-based HTTP client is used.
	ChromeHTTPClient
)

Enumeration of available HTTPClientType values.

func (HTTPClientType) String

func (t HTTPClientType) String() string

String returns string representation of HTTPClientType type.

type Request

type Request interface {
	// IsRequest is a dummy method to tag a struct
	// as implementing a Request interface.
	IsRequest()
}

Request interface represents either GoHTTPRequest or ChromeDPTasks.

type Response

type Response interface {
	// GetStatusCode returns response status code.
	GetStatusCode() int

	// GetReason return response status message
	// corresponding to the HTTP status code.
	GetReason() string

	// GetHeaders returns response headers.
	GetHeaders() http.Header

	// GetContent returns response content body.
	GetContent() []byte

	// GetError returns any error that occurred during the request processing.
	GetError() error
}

Response interface contains general methods for retrieving response info.

type ResponseMeta

type ResponseMeta struct {
	StatusCode   int
	StatusReason string
	Headers      http.Header
	Content      []byte
	Error        string
}

ResponseMeta provides implementation information about response performed with Chrome HTTP client

func (*ResponseMeta) GetContent

func (r *ResponseMeta) GetContent() []byte

func (*ResponseMeta) GetError

func (r *ResponseMeta) GetError() error

func (*ResponseMeta) GetHeaders

func (r *ResponseMeta) GetHeaders() http.Header

func (*ResponseMeta) GetReason

func (r *ResponseMeta) GetReason() string

func (*ResponseMeta) GetStatusCode

func (r *ResponseMeta) GetStatusCode() int

type UnknownHTTPClientError

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

UnknownHTTPClientError represents an error for unknown HTTP client types.

func NewUnknownHTTPClientError

func NewUnknownHTTPClientError(clientType HTTPClientType) *UnknownHTTPClientError

func (*UnknownHTTPClientError) Error

func (e *UnknownHTTPClientError) Error() string

Jump to

Keyboard shortcuts

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