Documentation
¶
Index ¶
- Constants
- type FormDataConfig
- type FormDataField
- type HttpConfig
- type HttpResponse
- func Download(remoteURL string, headers map[string]string, filePath, uagent string) (HttpResponse, error)
- func MultipartData(config HttpConfig, textFields map[string]string, fileFields map[string]string) (*HttpResponse, error)
- func SendMultipartFormData(config FormDataConfig) (*HttpResponse, error)
- func SendRequest(config HttpConfig) (*HttpResponse, error)
- type SoapConfig
- type SoapResponse
Constants ¶
View Source
const UserAgent = "gogutils_client/v0.2.1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FormDataConfig ¶
type FormDataField ¶
type HttpConfig ¶
type HttpConfig struct { Method string URL string Headers map[string]string Body []byte Timeout time.Duration LogResponse bool Cache bool RetrieveCache bool CacheTtl int64 UseProxy bool }
HTTPClientConfig contains the configuration for the HTTP client.
func ParseCurlCommand ¶ added in v1.0.9
func ParseCurlCommand(curlCommand string) (*HttpConfig, error)
ParseCurlCommand parses a curl command string and returns an HttpConfig.
type HttpResponse ¶
type HttpResponse struct { Address string Method string ElapsedTime int64 StatusCode int Headers map[string]string Body []byte FromCache bool CreatedUnix int64 CacheTtl int64 }
func Download ¶
func Download(remoteURL string, headers map[string]string, filePath, uagent string) (HttpResponse, error)
Download downloads a file from a remote URL and saves it to a local file.
func MultipartData ¶
func MultipartData(config HttpConfig, textFields map[string]string, fileFields map[string]string) (*HttpResponse, error)
func SendMultipartFormData ¶
func SendMultipartFormData(config FormDataConfig) (*HttpResponse, error)
func SendRequest ¶
func SendRequest(config HttpConfig) (*HttpResponse, error)
func (*HttpResponse) DeserializeCache ¶
func (resp *HttpResponse) DeserializeCache(hash string) error
LoadFromFile deserializes the HttpResponse from a JSON file.
func (*HttpResponse) IsCacheEXpired ¶
func (resp *HttpResponse) IsCacheEXpired() bool
func (*HttpResponse) SerializeCache ¶
func (resp *HttpResponse) SerializeCache(hash string) error
SaveToFile serializes the HttpResponse to a JSON file.
type SoapConfig ¶
type SoapConfig struct { URL string Headers map[string]string Body string Timeout time.Duration LogSoap bool }
SoapConfig contains the configuration for the SOAP client.
type SoapResponse ¶
SoapResponse represents the response from a SOAP call.
func SoapCall ¶
func SoapCall(config SoapConfig) (*SoapResponse, error)
func (*SoapResponse) IsSuccess ¶
func (resp *SoapResponse) IsSuccess() bool
Click to show internal directories.
Click to hide internal directories.