Skip to content

Commit

Permalink
feat(client): allow binary returns
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Nov 3, 2023
1 parent 583ed98 commit 3405391
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions internal/requestconfig/requestconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ func (cfg *RequestConfig) Execute() (err error) {
if cfg.ResponseBodyInto == nil {
return nil
}

if responseBodyInto, ok := cfg.ResponseBodyInto.(**http.Response); ok {
*responseBodyInto = res
return nil
}

contents, err := io.ReadAll(res.Body)
if err != nil {
return fmt.Errorf("error reading response body: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ func TestZoneListWithOptionalParams(t *testing.T) {
}

func TestZoneDelete(t *testing.T) {
t.Skip("body parameter is required")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
t.Skip("body parameter is required")
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("my-cloudflare-api-key"),
Expand Down
2 changes: 1 addition & 1 deletion zonesetting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ func TestZoneSettingList(t *testing.T) {
}

func TestZoneSettingEdit(t *testing.T) {
t.Skip("oneOf doesnt match")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
}
if !testutil.CheckTestServer(t, baseURL) {
return
}
t.Skip("oneOf doesnt match")
client := cloudflare.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("my-cloudflare-api-key"),
Expand Down

0 comments on commit 3405391

Please sign in to comment.