httpsimple

package
v0.63.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 13 Imported by: 35

Documentation

Index

Constants

View Source
const (
	// headerContentType = httputilmore.HeaderContentType
	BodyTypeForm = "form"
	BodyTypeJSON = "json"
	BodyTypeXML  = "xml"
)

Variables

This section is empty.

Functions

func Do

func Do(req Request) (*http.Response, error)

func DoMore added in v0.45.0

func DoMore(req Request) ([]byte, *http.Response, error)

Types

type Client added in v0.61.0

type Client struct {
	BaseURL    string
	Query      url.Values // Add If Not Exists
	HTTPClient *http.Client
}

Client provides a simple interface to making HTTP requests using `net/http`.

func NewClient added in v0.62.0

func NewClient(httpClient *http.Client, baseURL string) Client

func (*Client) Do added in v0.61.0

func (sc *Client) Do(req Request) (*http.Response, error)

func (*Client) DoUnmarshalJSON added in v0.61.0

func (sc *Client) DoUnmarshalJSON(req Request, resBody any) ([]byte, *http.Response, error)

func (*Client) Get added in v0.61.0

func (sc *Client) Get(reqURL string) (*http.Response, error)

type Request added in v0.61.0

type Request struct {
	Method        string
	URL           string
	Query         url.Values
	Headers       http.Header
	Body          any
	BodyType      string
	AddXMLDocType bool // only used if `Body` is a struct.
}

func NewRequest added in v0.61.0

func NewRequest() Request

func (*Request) BodyBytes added in v0.61.0

func (req *Request) BodyBytes() ([]byte, error)

func (*Request) Inflate added in v0.61.0

func (req *Request) Inflate()

Jump to

Keyboard shortcuts

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