request

package
v2.40.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 33 Imported by: 0

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 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

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 informatino 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