Documentation
¶
Index ¶
- func ExecuteTemplate(responseText []byte, resp *http.Response, input any, ...) ([]byte, error)
- func FlattenArrayMap[K string, V []string](m map[K]V) map[K]any
- func HasJSONHeader(h *http.Header) bool
- func RequestSupportsBody(method string) bool
- func TryUnescapeURL(v string) string
- type RequestDetails
- type RequestHandler
- func (r *RequestHandler) DryRunHandler(iostream *iostreams.IOStreams, options *c8y.RequestOptions, req *http.Request)
- func (r *RequestHandler) DumpRequest(w io.Writer, req *http.Request)
- func (r *RequestHandler) GetCurlCommands(requestOptions *c8y.RequestOptions, req *http.Request) (shell string, pwsh string, dummyFiles *curly.DummyFileCollection, err error)
- func (r *RequestHandler) GetTimeoutContext() (context.Context, context.CancelFunc)
- func (r *RequestHandler) PrintRequestDetails(w io.Writer, requestOptions *c8y.RequestOptions, req *http.Request)
- func (r *RequestHandler) ProcessRequestAndResponse(requests []c8y.RequestOptions, input any, ...) (*c8y.Response, error)
- func (r *RequestHandler) ProcessResponse(resp *c8y.Response, respError error, input any, ...) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteTemplate ¶ added in v2.32.0
func FlattenArrayMap ¶ added in v2.41.0
func HasJSONHeader ¶
HasJSONHeader returns true if the header contains a json content type
func RequestSupportsBody ¶
Check if method supports a body with the request
func TryUnescapeURL ¶ added in v2.41.0
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(requestOptions *c8y.RequestOptions, req *http.Request) (shell string, pwsh string, dummyFiles *curly.DummyFileCollection, 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)
Click to show internal directories.
Click to hide internal directories.