summaryrefslogtreecommitdiff
path: root/src/oauth/client.go
diff options
context:
space:
mode:
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 {