request

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderXForwardedProto    = "X-Forwarded-Code"
	HeaderXForwardedProtocol = "X-Forwarded-Protocol"
	HeaderXForwardedSsl      = "X-Forwarded-Ssl"
	HeaderXUrlScheme         = "X-Url-Protocol"
)
View Source
const Charset = "UTF-8"
View Source
const OAuthSignatureName = "oauth_signature"

Variables

This section is empty.

Functions

func Address

func Address(req *http.Request) (url string)

func FormatContentTypeAndCharset added in v0.0.2

func FormatContentTypeAndCharset(contentType string, charset ...string) string

func Get

func Get(url string, reply interface{}) (err error)

func HMACSHA1

func HMACSHA1(key, data string) string

func Post

func Post(url string, data interface{}, reply interface{}) (err error)

func Protocol

func Protocol(req *http.Request) string

func Request

func Request(method, url string, data interface{}) (reply []byte, err error)

Types

type Client

type Client struct {
	Binder binder.Interface
	// contains filtered or unexported fields
}

func New

func New() *Client

func (*Client) Get

func (this *Client) Get(url string, reply interface{}) (err error)

func (*Client) Post

func (this *Client) Post(url string, data interface{}, reply interface{}) (err error)

func (*Client) Request

func (this *Client) Request(method, url string, data interface{}) (reply []byte, err error)

func (*Client) Use

func (c *Client) Use(m middleware)

type OAuth

type OAuth struct {
	*Client

	Strict  bool  //严格模式,body会参与签名
	Timeout int32 //超时秒
	// contains filtered or unexported fields
}

func NewOAuth

func NewOAuth(key, secret string) *OAuth

func (*OAuth) NewOAuthParams

func (this *OAuth) NewOAuthParams() map[string]string

func (*OAuth) Signature

func (this *OAuth) Signature(method, address string, oauth map[string]string, body string) string

签名Signature method GET POST body JSON字符串

func (*OAuth) Verify

func (this *OAuth) Verify(req *http.Request) (err error)

Verify http(s)验签

Jump to

Keyboard shortcuts

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