Documentation
¶
Index ¶
- func ReadResponseBody(resp *http.Response) (string, error)
- type HTTPClient
- func (c *HTTPClient) CreateDeleteRequest(url string, headers map[string]string) (*http.Request, error)
- func (c *HTTPClient) CreateGetRequest(url string, headers map[string]string) (*http.Request, error)
- func (c *HTTPClient) CreatePostRequest(url string, headers map[string]string, body string) (*http.Request, error)
- func (c *HTTPClient) CreatePutRequest(url string, headers map[string]string, body string) (*http.Request, error)
- func (c *HTTPClient) SendRequest(req *http.Request) (*http.Response, error)
- func (c *HTTPClient) SetHeaders(req *http.Request, headers map[string]string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient represents a configured HTTP client
func NewHTTPClient ¶
func NewHTTPClient(cfg *config.Config) *HTTPClient
NewHTTPClient creates a new HTTP client with configuration Parameters: - cfg: *config.Config - Configuration containing timeout and other settings Returns: - *HTTPClient: A configured HTTP client instance
func (*HTTPClient) CreateDeleteRequest ¶ added in v0.4.0
func (c *HTTPClient) CreateDeleteRequest(url string, headers map[string]string) (*http.Request, error)
CreateDeleteRequest creates a new DELETE request Parameters: - url: string - The URL to send DELETE request to - headers: map[string]string - Optional headers to include Returns: - *http.Request: The created DELETE request - error: Any error that occurred during request creation
func (*HTTPClient) CreateGetRequest ¶
CreateGetRequest creates a new GET request Parameters: - url: string - The URL to send GET request to - headers: map[string]string - Optional headers to include Returns: - *http.Request: The created GET request - error: Any error that occurred during request creation
func (*HTTPClient) CreatePostRequest ¶
func (c *HTTPClient) CreatePostRequest(url string, headers map[string]string, body string) (*http.Request, error)
CreatePostRequest creates a new POST request Parameters: - url: string - The URL to send POST request to - headers: map[string]string - Optional headers to include - body: string - The request body Returns: - *http.Request: The created POST request - error: Any error that occurred during request creation
func (*HTTPClient) CreatePutRequest ¶ added in v0.4.0
func (c *HTTPClient) CreatePutRequest(url string, headers map[string]string, body string) (*http.Request, error)
CreatePutRequest creates a new PUT request Parameters: - url: string - The URL to send PUT request to - headers: map[string]string - Optional headers to include - body: string - The request body Returns: - *http.Request: The created PUT request - error: Any error that occurred during request creation
func (*HTTPClient) SendRequest ¶
SendRequest sends an HTTP request and returns the response Parameters: - req: *http.Request - The request to send Returns: - *http.Response: The response from the server - error: Any error that occurred during the request
func (*HTTPClient) SetHeaders ¶
func (c *HTTPClient) SetHeaders(req *http.Request, headers map[string]string)
SetHeaders sets headers for an HTTP request Parameters: - req: *http.Request - The request to set headers for - headers: map[string]string - Headers to set