sling

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 6 Imported by: 0

README

Sling

Go Go Reference

This is a fork of dghubble/sling. The purpose is for learning.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sling

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

Sling is an HTTP request builder and response receiver

func New

func New(httpClient slinghttp.Client) *Sling

New return barebone Sling

func (*Sling) AddHeader added in v1.4.0

func (s *Sling) AddHeader(key, value string) *Sling

func (*Sling) AddQueries added in v1.4.0

func (s *Sling) AddQueries(qs ...interface{}) *Sling

func (*Sling) AddQuery added in v1.4.0

func (s *Sling) AddQuery(q interface{}) *Sling

func (*Sling) BodyForm

func (s *Sling) BodyForm(data interface{}) *Sling

func (*Sling) BodyJSON

func (s *Sling) BodyJSON(data interface{}) *Sling

func (*Sling) BodyProvider

func (s *Sling) BodyProvider(bodyProvider slinghttp.BodyProvider) *Sling

func (*Sling) Clone added in v1.4.0

func (s *Sling) Clone() (*Sling, error)

Clone return Sling with same values All values are copied except HTTP client so that change in the clone will not affect the original

func (*Sling) Connect added in v1.2.0

func (s *Sling) Connect(reqURL string) *Sling

func (*Sling) Delete

func (s *Sling) Delete(reqURL string) *Sling

func (*Sling) Get

func (s *Sling) Get(reqURL string) *Sling

func (*Sling) HTTPClient added in v1.4.0

func (s *Sling) HTTPClient(client slinghttp.Client) *Sling

HTTPClient set HTTP client Fallback to http.DefaultClient

func (*Sling) Head

func (s *Sling) Head(reqURL string) *Sling

func (*Sling) Method added in v1.4.0

func (s *Sling) Method(method, reqURL string) *Sling

func (*Sling) Options added in v1.2.0

func (s *Sling) Options(reqURL string) *Sling

func (*Sling) Patch

func (s *Sling) Patch(reqURL string) *Sling

func (*Sling) Post

func (s *Sling) Post(reqURL string) *Sling

func (*Sling) Put

func (s *Sling) Put(reqURL string) *Sling

func (*Sling) Receive

func (s *Sling) Receive(v interface{}) error

func (*Sling) Request

func (s *Sling) Request() (*http.Request, error)

Request return HTTP request

func (*Sling) RequestURL added in v1.4.0

func (s *Sling) RequestURL(reqURL string) *Sling

RequestURL set request url Leave empty if error

func (*Sling) Response added in v1.4.0

func (s *Sling) Response() (*http.Response, error)

func (*Sling) ResponseDecoder added in v1.4.0

func (s *Sling) ResponseDecoder(rspDecoder slinghttp.ResponseDecoder) *Sling

func (*Sling) SetHeader added in v1.4.0

func (s *Sling) SetHeader(key, value string) *Sling

func (*Sling) Trace added in v1.2.0

func (s *Sling) Trace(reqURL string) *Sling

Directories

Path Synopsis
examples
github-api command

Jump to

Keyboard shortcuts

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