From 11dc6df88b93e5e767c4f82ca3245693afddc86a Mon Sep 17 00:00:00 2001 From: bagtoad <47394200+BagToad@users.noreply.github.com> Date: Sat, 23 Nov 2024 13:19:45 -0700 Subject: [PATCH] ScopesResponder wraps StatusScopesResponder --- pkg/httpmock/stub.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/httpmock/stub.go b/pkg/httpmock/stub.go index d1a27d835..196a047d8 100644 --- a/pkg/httpmock/stub.go +++ b/pkg/httpmock/stub.go @@ -225,17 +225,9 @@ func GraphQLQuery(body string, cb func(string, map[string]interface{})) Responde } } +// ScopesResponder returns a response with a 200 status code and the given OAuth scopes. func ScopesResponder(scopes string) func(*http.Request) (*http.Response, error) { - return func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: 200, - Request: req, - Header: map[string][]string{ - "X-Oauth-Scopes": {scopes}, - }, - Body: io.NopCloser(bytes.NewBufferString("")), - }, nil - } + return StatusScopesResponder(http.StatusOK, scopes) } // StatusScopesResponder returns a response with the given status code and OAuth scopes.