This commit is contained in:
parent
278073d7ab
commit
ec1abae2d6
1 changed files with 4 additions and 2 deletions
|
|
@ -246,12 +246,14 @@ func (e *EdgeConnect) DeleteAppInstance(ctx context.Context, appinstancekey AppI
|
||||||
}
|
}
|
||||||
|
|
||||||
func call[T any](ctx context.Context, client *EdgeConnect, path string, body []byte) (Responses[T], error) {
|
func call[T any](ctx context.Context, client *EdgeConnect, path string, body []byte) (Responses[T], error) {
|
||||||
|
log.Printf("call(): trying %s\n", path)
|
||||||
|
|
||||||
token, err := client.RetrieveToken(ctx)
|
token, err := client.RetrieveToken(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Responses[T]{}, err
|
return Responses[T]{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
request, err := http.NewRequestWithContext(ctx, "POST", path, bytes.NewBuffer(body))
|
request, err := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("%s/%s", client.BaseURL, path), bytes.NewBuffer(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Responses[T]{}, err
|
return Responses[T]{}, err
|
||||||
}
|
}
|
||||||
|
|
@ -278,7 +280,7 @@ func call[T any](ctx context.Context, client *EdgeConnect, path string, body []b
|
||||||
responses.Responses = append(responses.Responses, d)
|
responses.Responses = append(responses.Responses, d)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("call: %s resulting in %v and %v messages", path, resp.StatusCode, len(responses.Responses))
|
log.Printf("call(): %s resulting in %v and %v messages\n", path, resp.StatusCode, len(responses.Responses))
|
||||||
|
|
||||||
return responses, nil
|
return responses, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue