Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteWithContext ¶
Execute - execute the curl command with context
func GetCommand ¶
GetCommand - return a string list which is the curl command and a function which can remove the temporary file of request body. if inscure is true, the command will add '-k' the list can use strings.Join(result, " ") become a curl command string
Types ¶
type CurlRequest ¶
type CurlRequest interface {
// GenerateCommand - generate curl command with curl request
GenerateCommand(inscure bool) error
// GetCommands - get the curl command
GetCommands() []string
// GetFilename - get the filename which contains the request body
GetFilename() string
// Execute - execute the curl command
Execute() ([]byte, error)
// Do - execute the curl command and get the http.Response, like http.client.Do
Do() (*http.Response, error)
// AddHeader - add curl header
AddHeader(key, value string) error
// GetHeaders - get all the curl headers
GetHeaders() http.Header
// GetHeader - get the specific header value
GetHeader(key string) []string
// SetPrivateKey - set the private key
SetPrivateKey(fileType filetype.FileType, path string)
// SetCertificate - set the certificate
SetCertificate(fileType filetype.FileType, path, password string)
// SetCA - set the ca file
SetCA(filePath string)
}
func NewCurlRequest ¶
func NewCurlRequest(req *http.Request) (CurlRequest, error)
Click to show internal directories.
Click to hide internal directories.