From 8917e44aeef840919ff2a1168c6a005cc0b2b738 Mon Sep 17 00:00:00 2001 From: Robert Kopaczewski Date: Tue, 30 Aug 2022 04:18:58 +0200 Subject: [PATCH] pr changes --- .changelog/1068.txt | 2 +- cloudflare.go | 28 +--------------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/.changelog/1068.txt b/.changelog/1068.txt index cee415c6329..fa7259c79ad 100644 --- a/.changelog/1068.txt +++ b/.changelog/1068.txt @@ -1,3 +1,3 @@ ```release-note:enhancement -api: expose .RawContext and .RawContextWithHeaders methods +api: addded context and headers to Raw method ``` diff --git a/cloudflare.go b/cloudflare.go index 4dbd84d685b..b41550e1235 100644 --- a/cloudflare.go +++ b/cloudflare.go @@ -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