Skip to content

Commit

Permalink
fix nil panic (#4291)
Browse files Browse the repository at this point in the history
  • Loading branch information
weikanglim authored Sep 4, 2024
1 parent 590e616 commit 1558a34
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cli/azd/test/recording/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"testing"

"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -75,12 +76,18 @@ func TestBlobClientGetProperties(t *testing.T) {
}))

session := Start(t, WithHostMapping(strings.TrimPrefix(server.URL, "http://"), "127.0.0.1:80"))
proxyClient, err := proxyClient(session.ProxyUrl)
require.NoError(t, err)
var transport policy.Transporter
if session == nil {
transport = http.DefaultClient
} else {
proxyClient, err := proxyClient(session.ProxyUrl)
require.NoError(t, err)
transport = proxyClient
}

blobClient, err := blockblob.NewClientWithNoCredential(server.URL+"/test.txt", &blockblob.ClientOptions{
ClientOptions: azcore.ClientOptions{
Transport: proxyClient,
Transport: transport,
},
})
assert.NoError(t, err)
Expand Down

0 comments on commit 1558a34

Please sign in to comment.