http

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MEDIA_JSON  = "application/json"
	MEDIA_PLAIN = "text/plain"
	MEDIA_HTML  = "text/html"
	MEDIA_XML   = "text/xml"
)
View Source
const (
	// PROTOCOL_HTTP                   = "http://"
	// PROTOCOL_HTTPS                  = "https://"
	DEFAULT_TIMEOUT     = 10
	HTTP_LOG_ENABLE_KEY = "server.http.log.params"
)

Variables

This section is empty.

Functions

func Get

func Get(serviceName string, path string, params map[string]interface{}, result interface{}) (int, error)

func GetUrl

func GetUrl(url string, params map[string]interface{}, result interface{}) (int, error)

func Post

func Post(serviceName string, path string, params map[string]interface{}, result interface{}) (int, error)

func PostFile

func PostFile(url string, params map[string]interface{}, files map[string]*request.File, result interface{}) (int, error)

func PostJSON

func PostJSON(serviceName string, path string, params interface{}, result interface{}) (int, error)

func PostJSONString

func PostJSONString(serviceName string, path string, params string, result interface{}) (int, error)

func PostJSONStringUrl

func PostJSONStringUrl(url string, params string, result interface{}) (int, error)

func PostJSONUrl

func PostJSONUrl(url string, params interface{}, result interface{}) (int, error)

func PostJSONWithHeader

func PostJSONWithHeader(serviceName string, path string, headers map[string]string, params interface{}, result interface{}) (int, error)

func PostJSONWithHeaderUrl

func PostJSONWithHeaderUrl(url string, headers map[string]string, params interface{}, result interface{}) (int, error)

func PostUrl

func PostUrl(url string, params map[string]interface{}, result interface{}) (int, error)

func PostWithHeader

func PostWithHeader(serviceName string, path string, headers map[string]string, params map[string]interface{}, result interface{}) (int, error)

func PostWithHeaderUrl

func PostWithHeaderUrl(url string, headers map[string]string, params map[string]interface{}, result interface{}) (int, error)

Types

type Decoder

type Decoder interface {
	DecoderObj(resp []byte, obj interface{}) (Decoder, error)
}

func GetDecoder

func GetDecoder(ct string) Decoder

type JSONDecoder

type JSONDecoder struct{}

func (JSONDecoder) DecoderObj

func (d JSONDecoder) DecoderObj(resp []byte, obj interface{}) (Decoder, error)

type StreamDecoder

type StreamDecoder struct{}

func (StreamDecoder) DecoderObj

func (d StreamDecoder) DecoderObj(resp []byte, obj interface{}) (Decoder, error)

type StringDecoder

type StringDecoder struct{}

func (StringDecoder) DecoderObj

func (d StringDecoder) DecoderObj(resp []byte, obj interface{}) (Decoder, error)

Jump to

Keyboard shortcuts

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