summaryrefslogtreecommitdiff
path: root/src/oauth/client.go
diff options
context:
space:
mode:
authorDJ O'Leary <dijitol@proton.me>2026-09-07 03:13:01 +0200
committerDJ O'Leary <dijitol@proton.me>2026-09-07 03:13:01 +0200
commit2f61b07aea82fa0f5b98686bdfeba2e297c7b21b (patch)
treeb55f588e935b11decd782e7bd0a6c98f060e1654 /src/oauth/client.go
parent5d3efcc64fc9664e061b44659f85aeec03a56685 (diff)
refactor(cardmarket): move handlers to own directoryHEADmain
Diffstat (limited to 'src/oauth/client.go')
-rw-r--r--src/oauth/client.go17
1 files changed, 16 insertions, 1 deletions
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 {