rest

package module
v0.0.0-...-926e631 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 4 Imported by: 0

README

go-rest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHeaders

func AddHeaders(headers map[string]string, body []byte, request *http.Request)

AddHeaders adds the provided headers to the request

func AddQueryParams

func AddQueryParams(baseURL string, queryParams map[string]string) string

AddQueryParams adds the query params to base URL

func BuildRequest

func BuildRequest(requestData RequestData, request *http.Request) error

BuildRequest creates the request

Types

type Method

type Method string

Method holds the support HTTP methods

const (
	// Get GET HTTP method
	Get Method = "GET"

	// Post POST HTTP method
	Post Method = "POST"
)

Supported HTTP methods

type RequestData

type RequestData struct {
	Method      Method
	BaseURL     string
	Headers     map[string]string
	QueryParams map[string]string
	Body        []byte
}

RequestData holds the API relevant informations

Jump to

Keyboard shortcuts

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