http

package
v0.0.6-1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAuthenticationToken

func GenerateAuthenticationToken(b []byte, pk bmcrypto.PrivKey) string

Types

type Headers

type Headers struct {
	Headers map[string]string
}

func NewHeaders

func NewHeaders() Headers

func (*Headers) Get

func (h *Headers) Get(key string) string

func (*Headers) Has

func (h *Headers) Has(key string) bool

func (*Headers) Set

func (h *Headers) Set(key, value string)

type JsonOut

type JsonOut map[string]string

type RawJSONOut

type RawJSONOut map[string]interface{}

type Request

type Request struct {
	Method  string
	URL     string
	Body    string
	Headers Headers
}

func NetReqToReq

func NetReqToReq(r http.Request) Request

NetReqToReq converts net/http request to our own internal http request format

func NewRequest

func NewRequest(method, url, body string) Request

func (Request) ValidateAuthenticationToken

func (r Request) ValidateAuthenticationToken(pubKey, hashData string) bool

validateSignature validates a signature based on the authorization header

type Response

type Response struct {
	Body       string
	StatusCode int
	Headers    Headers
}

func CreateError

func CreateError(msg string, statusCode int) *Response

CreateError creates an error message json structure

func CreateOutput

func CreateOutput(data interface{}, statusCode int) *Response

createOutput creates json output for data

func NewResponse

func NewResponse(statusCode int, body string) Response

Jump to

Keyboard shortcuts

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