request

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(endpoint string) (*http.Response, error)

Debug sends request to the default pouchd server to get the debug info.

NOTE: without any vesion information.

func DecodeBody

func DecodeBody(obj interface{}, body io.ReadCloser) error

DecodeBody decodes body to obj.

func Delete

func Delete(endpoint string, opts ...Option) (*http.Response, error)

Delete sends request to the default pouchd server with custom request options.

func Get

func Get(endpoint string, opts ...Option) (*http.Response, error)

Get sends request to the default pouchd server with custom request options.

func Post

func Post(endpoint string, opts ...Option) (*http.Response, error)

Post sends post request to pouchd.

Types

type Option

type Option func(*http.Request) error

Option defines a type used to update http.Request.

func WithContext

func WithContext(ctx context.Context) Option

WithContext sets the ctx of http.Request.

func WithHeader

func WithHeader(key string, value string) Option

WithHeader sets the Header of http.Request.

func WithJSONBody

func WithJSONBody(obj interface{}) Option

WithJSONBody encodes the input data to JSON and sets it to the body in http.Request

func WithQuery

func WithQuery(query url.Values) Option

WithQuery sets the query field in URL.

func WithRawData

func WithRawData(data io.ReadCloser) Option

WithRawData sets the input data with raw data

Jump to

Keyboard shortcuts

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