rest

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

Note:

outResponseProtoBufObjectPtr: if err == nil, then this output parameter is guaranteed to be Not Nil

func POST

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

POST sends url post request to host with simple form data and retrieve the body response in string

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

Note:

outResponseProtoBufObjectPtr: if err == nil, then this output parameter is guaranteed to be Not Nil

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