Add context to the soapcalls API

This commit is contained in:
Alex Ballas
2023-05-23 19:44:51 +03:00
parent d8eec476da
commit 4e5131149e
10 changed files with 40 additions and 26 deletions

View File

@@ -1,15 +1,16 @@
package soapcalls
import (
"context"
"encoding/xml"
"fmt"
"net/http"
)
// GetFriendlyName returns the friendly name value for a the specific DMR url.
func GetFriendlyName(dmr string) (string, error) {
func GetFriendlyName(ctx context.Context, dmr string) (string, error) {
client := &http.Client{}
req, err := http.NewRequest(http.MethodGet, dmr, nil)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, dmr, nil)
if err != nil {
return "", fmt.Errorf("failed to create NewRequest for GetFriendlyName: %w", err)
}