Move api version string to repo config
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
rht committed
Dec 16, 2015 at 10:50 UTC
aabf80723d5d635695ea183c4ffe67d712cd51ae
3 files changed
+4
-3
commands/http/client.go
+1
-2
@@ -100,8 +100,7 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
100
} else {
101
httpReq.Header.Set(contentTypeHeader, applicationOctetStream)
102
}
103
- version := config.CurrentVersionNumber
104
- httpReq.Header.Set(uaHeader, fmt.Sprintf("/go-ipfs/%s/", version))
103
+ httpReq.Header.Set(uaHeader, config.ApiVersion)
104
105
ec := make(chan error, 1)
106
rc := make(chan cmds.Response, 1)
commands/http/handler.go
+1
-1
@@ -439,7 +439,7 @@ func apiVersionMatches(r *http.Request) error {
439
return nil
440
}
441
442
- daemonVersion := fmt.Sprintf("/go-ipfs/%s/", config.CurrentVersionNumber)
442
+ daemonVersion := config.ApiVersion
443
if daemonVersion != clientVersion {
444
return fmt.Errorf("%s (%s != %s)", errApiVersionMismatch, daemonVersion, clientVersion)
445
}
repo/config/version.go
+2
@@ -10,6 +10,8 @@ import (
10
// CurrentVersionNumber is the current application's version literal
11
const CurrentVersionNumber = "0.3.11-dev"
12
13
+const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/"
14
+
15
// CurrentCommit is the current git commit, this is set as a ldflag in the Makefile
16
var CurrentCommit string
17