request

package
v2.49.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: MIT Imports: 33 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteTemplate added in v2.32.0

func ExecuteTemplate(responseText []byte, resp *http.Response, input any, commonOptions config.CommonCommandOptions, duration time.Duration) ([]byte, error)

func FlattenArrayMap added in v2.41.0

func FlattenArrayMap[K string, V []string](m map[K]V) map[K]any

func HasJSONHeader

func HasJSONHeader(h *http.Header) bool

HasJSONHeader returns true if the header contains a json content type

func RequestSupportsBody

func RequestSupportsBody(method string) bool

Check if method supports a body with the request

func TryUnescapeURL added in v2.41.0

func TryUnescapeURL(v string) string

Types

type RequestDetails

type RequestDetails struct {
	URL         string            `json:"url,omitempty"`
	Host        string            `json:"host,omitempty"`
	PathEncoded string            `json:"pathEncoded,omitempty"`
	Path        string            `json:"path,omitempty"`
	Query       string            `json:"query,omitempty"`
	Method      string            `json:"method,omitempty"`
	Headers     map[string]string `json:"headers,omitempty"`
	Body        interface{}       `json:"body,omitempty"`
	Shell       string            `json:"shell,omitempty"`
	PowerShell  string            `json:"powershell,omitempty"`
}

type RequestHandler

type RequestHandler struct {
	Console *console.Console

	IsTerminal     bool
	IO             *iostreams.IOStreams
	Client         *c8y.Client
	Config         *config.Config
	Logger         *logger.Logger
	DataView       *dataview.DataView
	ActivityLogger *activitylogger.ActivityLogger
	HideSensitive  func(*c8y.Client, string) string
}

func (*RequestHandler) DryRunHandler

func (r *RequestHandler) DryRunHandler(iostream *iostreams.IOStreams, options *c8y.RequestOptions, req *http.Request)

func (*RequestHandler) DumpRequest

func (r *RequestHandler) DumpRequest(w io.Writer, req *http.Request)

func (*RequestHandler) GetCurlCommands

func (r *RequestHandler) GetCurlCommands(req *http.Request) (shell string, pwsh string, err error)

func (*RequestHandler) GetTimeoutContext

func (r *RequestHandler) GetTimeoutContext() (context.Context, context.CancelFunc)

func (*RequestHandler) PrintRequestDetails

func (r *RequestHandler) PrintRequestDetails(w io.Writer, requestOptions *c8y.RequestOptions, req *http.Request)

PrintRequestDetails prints the request to the console making it easier to extra information from it

func (*RequestHandler) ProcessRequestAndResponse

func (r *RequestHandler) ProcessRequestAndResponse(requests []c8y.RequestOptions, input any, commonOptions config.CommonCommandOptions) (*c8y.Response, error)

func (*RequestHandler) ProcessResponse

func (r *RequestHandler) ProcessResponse(resp *c8y.Response, respError error, input any, commonOptions config.CommonCommandOptions) (int, error)

Jump to

Keyboard shortcuts

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