Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Missing? http status in JestResult #220

Closed
bartekbp opened this issue Jul 2, 2015 · 4 comments
Closed

Missing? http status in JestResult #220

bartekbp opened this issue Jul 2, 2015 · 4 comments

Comments

@bartekbp
Copy link
Contributor

bartekbp commented Jul 2, 2015

Hi,

after using Jest for some time I've come across use cases where http status would be helpful e.g. We would like to ensure that index doesn't exist.
One way to do this it is to always perform DeleteIndex action and check whether status is equal to 2XX or 404. Without http status in JestResult it's difficult.
Is there any reason for not having this?

@kramer
Copy link
Member

kramer commented Jul 2, 2015

Status code is already used by the client to set the isSucceeded flag on result (true if 2XX, false otherwise) and in case the operation does not succeed you can get the reason via getErrorMessage.

@bartekbp
Copy link
Contributor Author

bartekbp commented Jul 2, 2015

Yes, but there are statuses for which there is no error message and 404 is one of them. So we would only get isSucceeded => false and nothing more.

@kramer
Copy link
Member

kramer commented Jul 2, 2015

And if we had the code in its own field then we would get 404 and nothing more, what difference does it make (considering all response codes from ES have binary meaning) ? :)

Regardless of that, if server returns non-2XX code and the response body is empty then you still get the response code in getErrorMessage.

@bartekbp
Copy link
Contributor Author

bartekbp commented Jul 2, 2015

I've never considered ES response codes as binary:) Also, I didn't know about status code in error message... All of this makes additional status not needed.
Thanks for help:)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants