Skip to content

Commit

Permalink
pr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
23doors committed Aug 30, 2022
1 parent abb8bc9 commit 8917e44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .changelog/1068.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```release-note:enhancement
api: expose .RawContext and .RawContextWithHeaders methods
api: addded context and headers to Raw method
```
28 changes: 1 addition & 27 deletions cloudflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,33 +473,7 @@ type RawResponse struct {

// Raw makes a HTTP request with user provided params and returns the
// result as untouched JSON.
func (api *API) Raw(method, endpoint string, data interface{}) (json.RawMessage, error) {
res, err := api.makeRequest(method, endpoint, data)
if err != nil {
return nil, err
}

var r RawResponse
if err := json.Unmarshal(res, &r); err != nil {
return nil, fmt.Errorf("%s: %w", errUnmarshalError, err)
}
return r.Result, nil
}

func (api *API) RawContext(ctx context.Context, method, endpoint string, data interface{}) (json.RawMessage, error) {
res, err := api.makeRequestContext(ctx, method, endpoint, data)
if err != nil {
return nil, err
}

var r RawResponse
if err := json.Unmarshal(res, &r); err != nil {
return nil, fmt.Errorf("%s: %w", errUnmarshalError, err)
}
return r.Result, nil
}

func (api *API) RawContextWithHeaders(ctx context.Context, method, endpoint string, data interface{}, headers http.Header) (json.RawMessage, error) {
func (api *API) Raw(ctx context.Context, method, endpoint string, data interface{}, headers http.Header) (json.RawMessage, error) {
res, err := api.makeRequestContextWithHeaders(ctx, method, endpoint, data, headers)
if err != nil {
return nil, err
Expand Down

0 comments on commit 8917e44

Please sign in to comment.