Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#2028)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed May 15, 2024
1 parent 7697a92 commit f3df125
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1286
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-69dd99f11f147729f5d95e3bcdee62057f64921f5f034ffac45948c8402697d2.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-52d9a2dc9d0868cab21ab7ca8255cacb967da100c31438203c397d7fefd5288c.yml
5 changes: 2 additions & 3 deletions internal/apierror/apierror.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package apierror

import (
"fmt"
"io"
"net/http"
"net/http/httputil"

Expand Down Expand Up @@ -39,8 +38,8 @@ func (r errorJSON) RawJSON() string {
}

func (r *Error) Error() string {
body, _ := io.ReadAll(r.Response.Body)
return fmt.Sprintf("%s \"%s\": %d %s %s", r.Request.Method, r.Request.URL, r.Response.StatusCode, http.StatusText(r.Response.StatusCode), string(body))
// Attempt to re-populate the response body
return fmt.Sprintf("%s \"%s\": %d %s %s", r.Request.Method, r.Request.URL, r.Response.StatusCode, http.StatusText(r.Response.StatusCode), r.JSON.RawJSON())
}

func (r *Error) DumpRequest(body bool) []byte {
Expand Down

0 comments on commit f3df125

Please sign in to comment.