Documentation
¶
Index ¶
- func GetAuthorizationHeader(bearerToken string) map[string]string
- func GetAuthorizationHeaderWithContentType(bearerToken string) map[string]string
- func UrlBuilder(url, endpoint string) string
- type CdiHTTPClient
- type StandardCdiHTTPClient
- func (c *StandardCdiHTTPClient) Delete(endpoint string, queryParams map[string]string, responseAddress any, ...) (int, error)
- func (c *StandardCdiHTTPClient) Get(endpoint string, queryParams map[string]string, responseAddress any, ...) (int, error)
- func (c *StandardCdiHTTPClient) Post(payload []byte, endpoint string, queryParams map[string]string, ...) (int, error)
- func (c *StandardCdiHTTPClient) Put(payload []byte, endpoint string, queryParams map[string]string, ...) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthorizationHeader ¶
func UrlBuilder ¶
UrlBuilder constructs a complete URL by combining a base URL and an endpoint. It ensures that the base URL does not end with a trailing slash ('/') before concatenating it with the endpoint. This prevents the creation of URLs with double slashes (e.g., "http://10.1.2.3//api/v1/users").
Parameters:
url: The base URL (e.g., "http://10.1.2.3"). endpoint: The endpoint to append to the base URL (e.g., "/users", "/products/123").
Returns:
A complete URL string.
Types ¶
type CdiHTTPClient ¶
type CdiHTTPClient interface {
Post(payload []byte, endpoint string, queryParams map[string]string, responseAddress any, headers map[string]string) (int, error)
Put(payload []byte, endpoint string, queryParams map[string]string, responseAddress any, headers map[string]string) (int, error)
Delete(endpoint string, queryParams map[string]string, responseAddress any, headers map[string]string) (int, error)
Get(endpoint string, queryParams map[string]string, responseAddress any, headers map[string]string) (int, error)
}
type StandardCdiHTTPClient ¶
func NewStandardCdiHTTPClient ¶
func NewStandardCdiHTTPClient(baseURI string) *StandardCdiHTTPClient
Click to show internal directories.
Click to hide internal directories.