hparser

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: Unlicense Imports: 5 Imported by: 0

Documentation

Overview

Package hparser provides a simple http wrapper that returns the usual HTTP response with a parsed HTML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default() *http.Client

Default returns a basic http.Client with a cookie jar. It implements the Client interface.

func Get

func Get(c Client, url string) (*http.Response, *html.Node, error)

Get issues a GET to the specified URL and parses the response body.

func PostForm

func PostForm(c Client, url string, data url.Values) (*http.Response, *html.Node, error)

PostForm issues a POST to the specified URL, with data's keys and values URL-encoded as the request body. The response body is parsed and closed.

Types

type Client

type Client interface {
	Get(url string) (resp *http.Response, err error)
	PostForm(url string, data url.Values) (resp *http.Response, err error)
}

Client is an interface that will be used by the Get and PostForm functions. It allows to use a custom HTTP client with a middleware.

Jump to

Keyboard shortcuts

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