lbrequest

package
v0.0.0-...-9f43f84 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(urlPath string, opts ...Opts) (*http.Request, error)

New creates an automate load balancer HTTP request with the modifications given in opts.

Types

type Opts

type Opts func(*requestOpts)

Opts are functional options for the automate load balancer http request

func WithAuthToken

func WithAuthToken(token string) Opts

WithAuthToken sets the auth token to use

func WithDefaultAuthToken

func WithDefaultAuthToken(token string) Opts

WithDefaultAuthToken sets the auth token to use in the case that WithAuthToken never set an auth token. We use it to set the admin token

func WithFormFile

func WithFormFile(filename string, data []byte) Opts

WithFormFile does a multipart form request

func WithJSONBody

func WithJSONBody(body string) Opts

WithJSONBody sets the body of a request. body should be a string containing json

func WithJSONObjectBody

func WithJSONObjectBody(body interface{}) Opts

WithJSONObjectBody sets the body of the request to a JSON marshalled object

func WithJSONStringTemplateBody

func WithJSONStringTemplateBody(tmpl string, params interface{}) Opts

WithJSONStringTemplateBody renders the given json template with the given parameters as the request body

func WithMethod

func WithMethod(method string) Opts

WithMethod sets the http method to use. By default, it is GET

func WithURL

func WithURL(url url.URL) Opts

WithURL sets the URL the request should be made to.

Jump to

Keyboard shortcuts

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