requests

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Requests

type Requests struct {
	*http.Request
	*http.Header
	*http.Client
	*http.Transport
	Params url.Values
}

func (*Requests) AsyncGet

func (r *Requests) AsyncGet(requestURL string, options ...func(*Requests)) (<-chan *Response, error)

AsyncGet sends an HTTP GET request to the provided URL and returns ch <-chan *http.Response immediately.

func (*Requests) AsyncPost

func (r *Requests) AsyncPost(requestURL, bodyType string, body io.Reader, options ...func(*Requests)) (<-chan *Response, error)

AsyncPost sends an HTTP POST request to the provided URL and returns a <-chan *http.Response immediately.

func (*Requests) Delete

func (r *Requests) Delete(requestURL string, options ...func(*Requests)) (*Response, error)

Delete sends an HTTP DELETE request to the provided URL.

func (*Requests) Get

func (r *Requests) Get(requestURL string, options ...func(*Requests)) (*Response, error)

Get sends a GET request to the provided url

func (*Requests) Head

func (r *Requests) Head(requestURL string, options ...func(*Requests)) (*Response, error)

Head sends an HTTP HEAD request to the specified URL, with the ability to add query parameters, headers, and timeout, among other options..

func (*Requests) JSONPost

func (r *Requests) JSONPost(requestURL string, body interface{}, options ...func(*Requests)) (*Response, error)

JSONPost Marshals request data as JSON and set the content type to "application/json".

func (*Requests) Options

func (r *Requests) Options(requestURL string) (*Response, error)

Options sends a rarely-used HTTP OPTIONS request to the provided URL. Options only permit a single parameter, which is the destination URL string.

func (*Requests) Patch

func (r *Requests) Patch(requestURL, bodyType string, body io.Reader, options ...func(*Requests)) (*Response, error)

Patch sends an HTTP PATCH request to the provided URL with optional body to update the data.

func (*Requests) Post

func (r *Requests) Post(requestURL, bodyType string, body io.Reader, options ...func(*Requests)) (*Response, error)

Post sends an HTTP POST request to the provided URL

func (*Requests) Put

func (r *Requests) Put(requestURL, bodyType string, body io.Reader, options ...func(*Requests)) (*Response, error)

Put sends HTTP PUT request to the provided URL.

func (*Requests) XMLPost

func (r *Requests) XMLPost(requestURL string, body interface{}, options ...func(*Requests)) (*Response, error)

XMLPost Marshals request data as XML and set the content type to "application/xml".

type Response

type Response struct {
	*http.Response
	Error      error
	StatusCode int
}

func (*Response) Bytes

func (r *Response) Bytes() ([]byte, error)

func (*Response) ContentType

func (r *Response) ContentType() (string, map[string]string, error)

func (*Response) JSON

func (r *Response) JSON() ([]byte, error)

func (*Response) String

func (r *Response) String() (string, error)

func (*Response) XML

func (r *Response) XML() ([]byte, error)

Jump to

Keyboard shortcuts

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