Skip to content

Commit

Permalink
tools/legacy-sdk: updating to support 204's
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Feb 15, 2024
1 parent 38ae8d6 commit ee40de5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/sdk/resourcemanager/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package resourcemanager
import (
"encoding/json"
"fmt"
"net/http"
"strings"
)

Expand All @@ -23,8 +24,12 @@ func (c TerraformClient) Get(input ServiceDetails) (*TerraformDetails, error) {
// TODO: handle this being a 404 etc

var response TerraformDetails
if err := json.NewDecoder(resp.Body).Decode(&response); err != nil {
return nil, err

// Data API V2 now returns a 204 when nothing
if resp.StatusCode == http.StatusOK {
if err := json.NewDecoder(resp.Body).Decode(&response); err != nil {
return nil, err
}
}

return &response, nil
Expand Down

0 comments on commit ee40de5

Please sign in to comment.