Documentation ¶
Index ¶
- Variables
- func HtmlNode(opt RequestOptions) (*goquery.Document, http.Response, error)
- func Request(opt RequestOptions) (http.Response, error)
- func RequestGithub(Repo, Release, Root string) error
- func RequestHtmlLinks(opt RequestOptions) ([]string, http.Response, error)
- func SaveFile(filePath string, opt RequestOptions) (http.Response, error)
- type Link
- type RequestOptions
- func (opt *RequestOptions) Do(jsonInterface any) (http.Response, error)
- func (opt *RequestOptions) File(filePath string) error
- func (opt *RequestOptions) MD5() (string, error)
- func (opt *RequestOptions) Request() (http.Response, error)
- func (opt *RequestOptions) SHA1() (string, error)
- func (opt *RequestOptions) SHA256() (string, error)
- func (w *RequestOptions) String() (string, error)
- func (w *RequestOptions) ToUrl() (*url.URL, error)
- func (opt *RequestOptions) WriteStream(writer io.Writer) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoUrl = errors.New("no url informed") ErrPageNotExist = errors.New("page not exists") )
View Source
var DefaultHeader = http.Header{
"Accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"},
"Accept-Language": {"en-US;q=0.9,en;q=0.8"},
"Sec-Ch-Ua": {`"Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123\"`},
"Sec-Ch-Ua-Mobile": {"?0"},
"Sec-Ch-Ua-Platform": {`"Windows"`},
"Sec-Fetch-Dest": {"document"},
"Sec-Fetch-Mode": {"navigate"},
"Sec-Fetch-Site": {"none"},
"Sec-Fetch-User": {"?1"},
"Upgrade-Insecure-Requests": {"1"},
"User-Agent": {"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"},
}
Functions ¶
func Request ¶
func Request(opt RequestOptions) (http.Response, error)
Make custom request and return request, response and error if exist
func RequestGithub ¶
func RequestHtmlLinks ¶
func RequestHtmlLinks(opt RequestOptions) ([]string, http.Response, error)
Types ¶
type Link ¶
func ParseMultipleLinks ¶
type RequestOptions ¶
type RequestOptions struct { Url string // Request url HttpError bool // Return if status code is equal or then 300 Method string // Request Method Body io.Reader // Body Reader Headers http.Header // Extra HTTP Headers Querys map[string]string // Default querys to set in url CodesRetrys []int // Code to retrys in GET method }
func (*RequestOptions) File ¶
func (opt *RequestOptions) File(filePath string) error
func (*RequestOptions) MD5 ¶
func (opt *RequestOptions) MD5() (string, error)
Create request and calculate MD5 for body response
func (*RequestOptions) SHA1 ¶
func (opt *RequestOptions) SHA1() (string, error)
Create request and calculate SHA1 for body response, recomends use SHA256
func (*RequestOptions) SHA256 ¶
func (opt *RequestOptions) SHA256() (string, error)
Create request and calculate SHA256 for body response
func (*RequestOptions) String ¶
func (w *RequestOptions) String() (string, error)
func (*RequestOptions) WriteStream ¶
func (opt *RequestOptions) WriteStream(writer io.Writer) error
Click to show internal directories.
Click to hide internal directories.