提交 aabf8072 作者: rht 提交者: Jeromy

Move api version string to repo config

License: MIT
Signed-off-by: 's avatarrht <rhtbot@gmail.com>
上级 01239711
......@@ -100,8 +100,7 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
} else {
httpReq.Header.Set(contentTypeHeader, applicationOctetStream)
}
version := config.CurrentVersionNumber
httpReq.Header.Set(uaHeader, fmt.Sprintf("/go-ipfs/%s/", version))
httpReq.Header.Set(uaHeader, config.ApiVersion)
ec := make(chan error, 1)
rc := make(chan cmds.Response, 1)
......
......@@ -439,7 +439,7 @@ func apiVersionMatches(r *http.Request) error {
return nil
}
daemonVersion := fmt.Sprintf("/go-ipfs/%s/", config.CurrentVersionNumber)
daemonVersion := config.ApiVersion
if daemonVersion != clientVersion {
return fmt.Errorf("%s (%s != %s)", errApiVersionMismatch, daemonVersion, clientVersion)
}
......
......@@ -10,6 +10,8 @@ import (
// CurrentVersionNumber is the current application's version literal
const CurrentVersionNumber = "0.3.11-dev"
const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/"
// CurrentCommit is the current git commit, this is set as a ldflag in the Makefile
var CurrentCommit string
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论