elastic / elasticsearch-rs

Official Elasticsearch Rust Client
https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html
Apache License 2.0
702 stars 72 forks source link

Use text/plain content-type and accept headers for cat APIs #72

Closed russcam closed 4 years ago

russcam commented 4 years ago

This commit updates the api_generator to set text/plain content-type and accept headers by default for all cat APIs.

It also introduces a read_body_as_text async fn on Response to be able to treat the response body as plain text

Closes #71

russcam commented 4 years ago

Not overly keen on the fn name read_body_as_text() but named it in line with the existing read_body. I am considering breaking here and renaming them simply to text() and json(), respectively, which would mirror reqwest.

mwilliammyers commented 4 years ago

I agree, I like text() and json() better. Would we change read_body() if we went with text() and json()?

russcam commented 4 years ago

Would we change read_body() if we went with text() and json()?

Yeah, I was thinking

mwilliammyers commented 4 years ago

Oh haha, duh 🙃

Yeah, I vote for that.

russcam commented 4 years ago

Merged this in and opened #74 for the renaming breaking change

russcam commented 4 years ago

Labelled this also a breaking change as the default response format for cat APIs is now plain text