support If-None-Match

This commit is contained in:
yuzuki999
2023-06-25 07:49:51 +08:00
parent 163cd2a6dc
commit 9af5d1a6e7
3 changed files with 7 additions and 3 deletions

View File

@@ -68,11 +68,14 @@ type NodeInfo struct {
func (c *Client) GetNodeInfo() (node *NodeInfo, err error) {
const path = "/api/v1/server/UniProxy/config"
r, err := c.client.R().Get(path)
r, err := c.client.
R().
SetHeader("If-None-Match", c.etag).
Get(path)
if err = c.checkResponse(r, path, err); err != nil {
return
}
if c.etag == r.Header().Get("ETag") { // node info not changed
if r.StatusCode() == 304 {
return nil, nil
}
// parse common params