http_utils

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POST = "POST"

	ContentType     = "Content-Type"
	ApplicationJSON = "application/json"

	AuthorizationHeader = "Authorization"
	SignatureHeader     = "X-Signature-256"
)

Variables

This section is empty.

Functions

func DoRequestAndCatchUnsuccessful

func DoRequestAndCatchUnsuccessful(request *http.Request) (*http.Response, error)

DoRequestAndCatchUnsuccessful sends a http request. If the response code != 200 then it returns an error.

func GenerateAuthenticatedPostRequest

func GenerateAuthenticatedPostRequest(url, authToken, hash string, body []byte) (*http.Request, error)

GenerateAuthenticatedPostRequest creates a POST http.Request adding a token to the AuthorizationHeader header and hash to the SignatureHeader

func SignMessage

func SignMessage(msg []byte, secret string) string

SignMessage uses HMAC & SHA256 hashing to sign a message

Types

This section is empty.

Jump to

Keyboard shortcuts

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