rest

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneHeader

func CloneHeader(in http.Header) http.Header

func CloneRequest

func CloneRequest(req *http.Request) *http.Request

Create shallow copy of request with deep copy of the headers

func NewBearerAuthRoundTripper

func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Interface

type Interface interface {
	Verb(verb string) *Request
	Get() *Request
}

type RESTClient

type RESTClient struct {
	Client *http.Client
	// contains filtered or unexported fields
}

Implenents Interface

func NewRESTClient

func NewRESTClient(baseURL *url.URL, versionedAPIPath string, client *http.Client) (*RESTClient, error)

func (*RESTClient) Get

func (c *RESTClient) Get() *Request

func (*RESTClient) Verb

func (c *RESTClient) Verb(verb string) *Request

func (*RESTClient) Version

func (c *RESTClient) Version() string

type Request

type Request struct {
	// contains filtered or unexported fields
}

Implements HTTPClient

func NewRequest

func NewRequest(client HTTPClient, verb string, baseURL *url.URL, versionedAPIPath string) *Request

func (*Request) Do

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

func (*Request) Headers

func (r *Request) Headers() *http.Header

func (*Request) Path

func (r *Request) Path(path string) *Request

func (*Request) SetHeader

func (r *Request) SetHeader(key, value string) *Request

func (*Request) SetParam

func (r *Request) SetParam(key, value string) *Request

func (*Request) SubPath

func (r *Request) SubPath(subpath string) *Request

func (*Request) URL

func (r *Request) URL() *url.URL

Return the current Request working url

type Result

type Result struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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