1
0
Fork 0

Merge pull request #368 from rqlite/cli_auth

CLI checks for HTTP 401
master
Philip O'Toole 7 years ago committed by GitHub
commit 92593f3d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,6 @@
## 4.2.1 (unreleased)
- [PR #367](https://github.com/rqlite/rqlite/pull/367): Remove superflous leading space at CLI prompt.
- [PR #368](https://github.com/rqlite/rqlite/pull/368): CLI displays clear error message when not authorized.
## 4.2.0 (October 19th 2017)
- [PR #354](https://github.com/rqlite/rqlite/pull/354): Vendor Raft.

@ -133,6 +133,10 @@ func sendRequest(ctx *cli.Context, urlStr string, line string, argv *argT, ret i
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusUnauthorized {
return fmt.Errorf("unauthorized")
}
// Check for redirect.
if resp.StatusCode == http.StatusMovedPermanently {
nRedirect++
@ -190,6 +194,10 @@ func cliJSON(ctx *cli.Context, cmd, line, url string, argv *argT) error {
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusUnauthorized {
return fmt.Errorf("unauthorized")
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err

Loading…
Cancel
Save