From 2f61b07aea82fa0f5b98686bdfeba2e297c7b21b Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Mon, 7 Sep 2026 03:13:01 +0200 Subject: refactor(cardmarket): move handlers to own directory --- src/oauth/client.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/oauth') diff --git a/src/oauth/client.go b/src/oauth/client.go index 684cb20..fa5d04b 100644 --- a/src/oauth/client.go +++ b/src/oauth/client.go @@ -51,6 +51,14 @@ func (c *Client) GetWithContext( return c.request(ctx, http.MethodGet, url, "", nil) } +func (c *Client) PutWithContext( + ctx context.Context, + url, contentType string, + body io.Reader, +) (*http.Response, error) { + return c.request(ctx, http.MethodPut, url, contentType, body) +} + func (c *Client) PostWithContext( ctx context.Context, url, contentType string, @@ -59,6 +67,13 @@ func (c *Client) PostWithContext( return c.request(ctx, http.MethodPost, url, contentType, body) } +func (c *Client) DeleteWithContext( + ctx context.Context, + url string, +) (*http.Response, error) { + return c.request(ctx, http.MethodDelete, url, "", nil) +} + // request hydrates and fulfils a http.Request using information stored in the client func (c *Client) request( ctx context.Context, @@ -72,7 +87,7 @@ func (c *Client) request( } if contentType != "" { - req.Header.Set("Content-Type", contentType) + req.Header.Set(headerContentType, contentType) } if err = c.authorize(req); err != nil { -- cgit v1.2.3