Skip to content

Commit

Permalink
address review: use response helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Feb 23, 2024
1 parent c9b0ac7 commit e57d964
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion storage/2023-11-03/blob/containers/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"strings"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
"github.com/tombuildsstuff/giovanni/storage/internal/metadata"
Expand Down Expand Up @@ -47,7 +48,7 @@ func (c Client) Create(ctx context.Context, containerName string, input CreateIn
// Retry the container creation if a conflicting container is still in the process of being deleted
retryFunc := func(resp *http.Response, _ *odata.OData) (bool, error) {
if resp != nil {
if resp.StatusCode == http.StatusConflict {
if response.WasStatusCode(resp, http.StatusConflict) {
// TODO: move this error response parsing to a common helper function
respBody, err := io.ReadAll(resp.Body)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion storage/2023-11-03/file/shares/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strconv"
"strings"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-sdk/sdk/client"
"github.com/hashicorp/go-azure-sdk/sdk/odata"
"github.com/tombuildsstuff/giovanni/storage/internal/metadata"
Expand Down Expand Up @@ -68,7 +69,7 @@ func (c Client) Create(ctx context.Context, shareName string, input CreateInput)
// Retry the share creation if a conflicting share is still in the process of being deleted
retryFunc := func(resp *http.Response, _ *odata.OData) (bool, error) {
if resp != nil {
if resp.StatusCode == http.StatusConflict {
if response.WasStatusCode(resp, http.StatusConflict) {
// TODO: move this error response parsing to a common helper function
respBody, err := io.ReadAll(resp.Body)
if err != nil {
Expand Down

0 comments on commit e57d964

Please sign in to comment.