Add connect backend tests (#546)

This commit is contained in:
Dan Sosedoff
2022-01-08 14:45:21 -06:00
committed by GitHub
parent 0794c642e4
commit e2f5e06c07
3 changed files with 166 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package api
import (
"context"
"encoding/base64"
"fmt"
"net/http"
@@ -94,8 +95,11 @@ func ConnectWithBackend(c *gin.Context) {
PassHeaders: command.Opts.ConnectHeaders,
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
// Fetch connection credentials
cred, err := backend.FetchCredential(c.Param("resource"), c)
cred, err := backend.FetchCredential(ctx, c.Param("resource"), c)
if err != nil {
badRequest(c, err)
return