refactor: moved http.Client to model.RequestContext

Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
SoXX 2023-10-23 10:29:27 +02:00
parent e063db1d59
commit bd1f33dced

View File

@ -80,7 +80,7 @@ func GetTag(requestContext model.RequestContext, ID string) (model.Tag, error) {
// Returns:
// - []model.Tag: A slice of tags.
// - error: An error, if any, encountered during the API request or response handling.
func GetTags(client http.Client, requestContext model.RequestContext, query map[string]string) ([]model.Tag, error) {
func GetTags(requestContext model.RequestContext, query map[string]string) ([]model.Tag, error) {
// Create a new HTTP GET request.
r, err := http.NewRequest("GET", fmt.Sprintf("%s/tags.json", requestContext.Host), nil)
if err != nil {
@ -99,7 +99,7 @@ func GetTags(client http.Client, requestContext model.RequestContext, query map[
r.SetBasicAuth(requestContext.Username, requestContext.APIKey)
// Send the request using the provided http.Client.
resp, err := client.Do(r)
resp, err := requestContext.Client.Do(r)
if err != nil {
log.Print(err)
}