Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpapi: support /status to show PD version #664

Merged
merged 6 commits into from
Jul 3, 2017
Merged

httpapi: support /status to show PD version #664

merged 6 commits into from
Jul 3, 2017

Conversation

choleraehyq
Copy link
Contributor

See #551
PTAL @siddontang @nolouch
Signed-off-by: Cholerae Hu choleraehyq@gmail.com

@CLAassistant
Copy link

CLAassistant commented Jun 29, 2017

CLA assistant check
All committers have signed the CLA.

@disksing
Copy link
Contributor

Please sign the CLA @choleraehyq .

@@ -0,0 +1,34 @@
package api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add license header at the top of the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

func (h *statusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seem the default type is json, no need to set this, please ensure it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I removed it.

@nolouch
Copy link
Contributor

nolouch commented Jun 29, 2017

LGTM

@siddontang
Copy link
Contributor

Please add test

Signed-off-by: Cholerae Hu <choleraehyq@gmail.com>
Signed-off-by: Cholerae Hu <choleraehyq@gmail.com>
Signed-off-by: Cholerae Hu <choleraehyq@gmail.com>
Signed-off-by: Cholerae Hu <choleraehyq@gmail.com>
@choleraehyq
Copy link
Contributor Author

@siddontang Test added.

resp, err := s.hc.Get(addr)
c.Assert(err, IsNil)
buf, err := ioutil.ReadAll(resp.Body)
c.Assert(err, IsNil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

miss resp.Body.Close

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


for _, num := range numbers {
cfgs, _, clean := mustNewCluster(c, num)
defer clean()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't call defer in for loop.

Signed-off-by: Cholerae Hu <choleraehyq@gmail.com>
Copy link
Contributor

@siddontang siddontang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@siddontang
Copy link
Contributor

PTAL @disksing

@choleraehyq
Copy link
Contributor Author

@disksing Can this be merged?

@siddontang siddontang merged commit 71a083f into tikv:master Jul 3, 2017
@sre-bot sre-bot added the contribution Indicates that the PR was contributed by an external member. label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution Indicates that the PR was contributed by an external member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants