rest

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendServerCAPemFiles added in v1.1.4

func AppendServerCAPemFiles(caPemFilePath ...string) error

AppendServerCAPemFiles adds self-signed server ca pems to local cache, and then recreates the clientTlsConfig object based on the new list of CAs

func DELETE added in v1.1.4

func DELETE(url string, headers []*HeaderKeyValue) (statusCode int, body string, err error)

DELETE sends url delete request to host and performs delete action (no body expected)

Default Header = Content-Type: application/x-www-form-urlencoded

JSON Content-Type Header:

Content-Type: application/json

func DELETEProtoBuf added in v1.1.4

func DELETEProtoBuf(url string, headers []*HeaderKeyValue, outResponseProtoBufObjectPtr proto.Message) (statusCode int, err error)

DELETEProtoBuf sends url delete request to host, and retrieves response via protobuf object as an output pointer parameter

default header if not specified:

Content-Type: application/x-protobuf

func GET

func GET(url string, headers []*HeaderKeyValue) (statusCode int, body string, err error)

GET sends url get request to host and retrieve the body response in string

func GETProtoBuf

func GETProtoBuf(url string, headers []*HeaderKeyValue, outResponseProtoBufObjectPtr proto.Message) (statusCode int, err error)

GETProtoBuf sends url get request to host, and retrieves response via protobuf object as an output pointer parameter

default header if not specified:

Content-Type: application/x-protobuf

func POST

func POST(url string, headers []*HeaderKeyValue, requestBody string) (statusCode int, responseBody string, err error)

POST sends url post request to host and retrieve the body response in string

Default Header = Content-Type: application/x-www-form-urlencoded

JSON Content-Type Header:

Content-Type: application/json

func POSTProtoBuf

func POSTProtoBuf(url string, headers []*HeaderKeyValue, requestProtoBufObjectPtr proto.Message, outResponseProtoBufObjectPtr proto.Message) (statusCode int, err error)

POSTProtoBuf sends url post request to host, with body content in protobuf pointer object, and retrieves response in protobuf object as output pointer parameter

default header if not specified:

Content-Type: application/x-protobuf

func PUT added in v1.1.4

func PUT(url string, headers []*HeaderKeyValue, requestBody string) (statusCode int, responseBody string, err error)

PUT sends url put request to host and retrieve the body response in string

Default Header = Content-Type: application/x-www-form-urlencoded

JSON Content-Type Header:

Content-Type: application/json

func PUTProtoBuf added in v1.1.4

func PUTProtoBuf(url string, headers []*HeaderKeyValue, requestProtoBufObjectPtr proto.Message, outResponseProtoBufObjectPtr proto.Message) (statusCode int, err error)

PUTProtoBuf sends url put request to host, with body content in protobuf pointer object, and retrieves response in protobuf object as output pointer parameter

default header if not specified:

Content-Type: application/x-protobuf

func ResetServerCAPemFiles added in v1.1.4

func ResetServerCAPemFiles(caPemFilePath ...string) error

ResetServerCAPemFiles first clears serverCaPems cache, then adds self-signed server ca pems to local cache, then recreates the clientTlsConfig object based on the new list of CAs

Types

type HeaderKeyValue

type HeaderKeyValue struct {
	Key   string
	Value string
}

HeaderKeyValue is struct used for containing http header element key value pair

Jump to

Keyboard shortcuts

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