request

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 supernode server to get the debug info.

NOTE: without any version 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 supernode server with custom request options.

func Get

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

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

func Post

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

Post sends post request to supernode.

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