Documentation
¶
Overview ¶
Package requests is a pythonic HTTP library for Gopher
Package requests wrap net/http like requests did for python it is easy to use, but not very efficient
Index ¶
- Constants
- Variables
- func ExtractBasicAuth(val string) (username string, password string, err error)
- func ExtractBasicAuthFromRequest(r *http.Request) (string, string, error)
- func GenerateBasicAuth(username string, password string) string
- func GetJSON(url string, data interface{}) error
- func GetJSONStringMap(url string) (map[string]string, error)
- type Client
- func (client *Client) Get(url string) (*Response, error)
- func (client *Client) GetJSON(url string, data interface{}) error
- func (client *Client) GetJSONStringMap(url string) (map[string]string, error)
- func (client *Client) PostJSONBytes(url string, data []byte) (*Response, error)
- func (client *Client) PostJSONString(url string, data string) (*Response, error)
- type Response
Constants ¶
View Source
const ( ShadowSocksLocal = "127.0.0.1:1080" ContentJSON = "application/json" )
View Source
const AuthorizationHeader = "Authorization"
Variables ¶
View Source
var TransportBuilder transportBuilder
TODO: might switch to functional options https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis TODO: http proxy? might just use environment variable? https://stackoverflow.com/questions/14661511/setting-up-proxy-for-http-client TransportBuilder is the initial builder, its method return a new copy for chaining and keep itself unchanged
Functions ¶
func ExtractBasicAuth ¶
func GenerateBasicAuth ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetJSONStringMap ¶
func (*Client) PostJSONBytes ¶
Click to show internal directories.
Click to hide internal directories.