Documentation
¶
Index ¶
- func CreateBodyFromBytes(contentType string, bodyData []byte) *common.Body
- func CreateHTTPResponse(statusCode int, redirectChain []string, headers map[string][]string, ...) common.HttpResponse
- func CreateHTTPResponseFromBytes(statusCode int, redirectChain []string, headers map[string][]string, ...) common.HttpResponse
- func GetHeaderValueFromHeaderMap(headers map[string][]string, name string) *string
- func GetResponseBodyStringFromBodyStruct(body *common.Body) *string
- func GetUserAgentFlag(cmd *cobra.Command) (common.UserAgentPreset, error)
- func RemoveScheme(url string) string
- func SplitTargetURL(target string) (string, string, map[string]string, error)
- func ValidateUserAgentWithRequestMethod(userAgent common.UserAgentPreset, requestMethod common.RequestMethod) error
- type MethodFlagData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBodyFromBytes ¶ added in v0.0.141
CreateBodyFromBytes creates a Body struct based on content type and body data as bytes
func CreateHTTPResponse ¶
func CreateHTTPResponse(statusCode int, redirectChain []string, headers map[string][]string, responseBody string) common.HttpResponse
CreateHTTPResponse creates an HttpResponse struct from HttpResponse data (string version) This is a compatibility wrapper that converts string to bytes
func CreateHTTPResponseFromBytes ¶ added in v0.0.141
func CreateHTTPResponseFromBytes(statusCode int, redirectChain []string, headers map[string][]string, responseBody []byte) common.HttpResponse
CreateHTTPResponseFromBytes creates an HttpResponse struct from HttpResponse data using byte array
func GetHeaderValueFromHeaderMap ¶
GetHeaderValueFromHeaderMap extracts a single header value from response header map. Returns the first value found for the given header name, or nil if not found.
func GetResponseBodyStringFromBodyStruct ¶
GetResponseBodyStringFromBodyStruct extracts string content from a Body struct
func GetUserAgentFlag ¶ added in v0.0.242
func GetUserAgentFlag(cmd *cobra.Command) (common.UserAgentPreset, error)
GetUserAgentFlag extracts and validates the user-agent flag from a cobra command. Returns UserAgentPresetRandom if the flag is not registered on this command.
func RemoveScheme ¶ added in v0.0.93
RemoveScheme removes http:// or https:// from the beginning of a string
func SplitTargetURL ¶
SplitTargetURL splits a target URL and standardizes it into its base URL, path, and query parameter components.
func ValidateUserAgentWithRequestMethod ¶ added in v0.0.242
func ValidateUserAgentWithRequestMethod(userAgent common.UserAgentPreset, requestMethod common.RequestMethod) error
ValidateUserAgentWithRequestMethod returns an error if the user explicitly set --user-agent to a non-default value while using a request method that ignores it (headless or browserbase). If --user-agent was left at the default (RANDOM), no error is returned since the user didn't explicitly request a specific UA.
Types ¶
type MethodFlagData ¶ added in v0.0.93
type MethodFlagData struct {
RequestMethodEnum common.RequestMethod
HeadlessConfig *common.HeadlessRequestConfig
BrowserbaseConfig *common.BrowserbaseRequestConfig
BrowserbaseSecrets *common.BrowserbaseRequestSecrets
}
MethodFlagData holds all the configuration related to request methods
func GetRequestMethodFlags ¶ added in v0.0.93
func GetRequestMethodFlags(cmd *cobra.Command) (*MethodFlagData, error)
GetRequestMethodFlags extracts and validates all request method related configuration from a cobra command