summaryrefslogtreecommitdiff
path: root/internal/http/http.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-07-04 15:27:10 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-07-17 14:00:03 +0000
commitcb8e2a5ae27aa34f2a9ad21469538403274e3b3e (patch)
tree249a879f30f2bcf7e6ad38c66dad135e8d22c747 /internal/http/http.go
parent895112235b9239d8db9f129451605e1e8b9c2a12 (diff)
Discovery: Implement conditional requests
From docs.eduvpn.org (https://docs.eduvpn.org/server/v3/server-discovery.html): When fetching the new JSON files, the client SHOULD use conditional requests, so the file is only fetched in case there were changes. This, in order to reduce the amount of traffic required by VPN clients, especially relevant for metered, or slow connections. The If-Modified-Since request header SHOULD be used for this. If the response code is 304, the file hasn’t changed since. The value to use for the If-Modified-Since request header is the exact value of the Last-Modified response header for the last successful download, i.e. 200 response. You SHOULD store the value of Last-Modified and use it as-is for the If-Modified-Since header.
Diffstat (limited to 'internal/http/http.go')
-rw-r--r--internal/http/http.go5
1 files changed, 0 insertions, 5 deletions
diff --git a/internal/http/http.go b/internal/http/http.go
index 09f1953..196998b 100644
--- a/internal/http/http.go
+++ b/internal/http/http.go
@@ -164,11 +164,6 @@ func (c *Client) Get(ctx context.Context, url string) (http.Header, []byte, erro
return c.Do(ctx, http.MethodGet, url, nil)
}
-// PostWithOpts creates a Post request with optional parameters and returns the headers, body and an error.
-func (c *Client) PostWithOpts(ctx context.Context, url string, opts *OptionalParams) (http.Header, []byte, error) {
- return c.Do(ctx, http.MethodPost, url, opts)
-}
-
// Do sends a HTTP request using a method (e.g. GET, POST), an url and optional parameters
// It returns the HTTP headers, the body and an error if there is one.
func (c *Client) Do(ctx context.Context, method string, urlStr string, opts *OptionalParams) (http.Header, []byte, error) {