httputils

package
v2.1.21+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_AGENT = "yunioncloud-go/201708"
)

Variables

This section is empty.

Functions

func GetAddrPort

func GetAddrPort(urlStr string) (string, int, error)

func GetClient

func GetClient(insecure bool) *http.Client

func GetDefaultClient

func GetDefaultClient() *http.Client

func JSONRequest

func JSONRequest(client *http.Client, ctx context.Context, method string, urlStr string, header http.Header, body jsonutils.JSONObject, debug bool) (http.Header, jsonutils.JSONObject, error)

func ParseJSONResponse

func ParseJSONResponse(resp *http.Response, err error, debug bool) (http.Header, jsonutils.JSONObject, error)

func Request

func Request(client *http.Client, ctx context.Context, method string, urlStr string, header http.Header, body io.Reader, debug bool) (*http.Response, error)

Types

type Error

type Error struct {
	Id     string
	Fields []string
}

type JSONClientError

type JSONClientError struct {
	Code    int
	Class   string
	Details string
	Data    Error
}

func (*JSONClientError) Error

func (e *JSONClientError) Error() string

Jump to

Keyboard shortcuts

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