Rocket: `Content-Type` inconsistent between `String` and `&str`

Created on 25 Dec 2016  路  2Comments  路  Source: SergioBenitez/Rocket

The Content-Type for String is text/html, but it is text/plain for &str. This seems like an unintuitive behavior, one would expect them to behave the same. Is there a reason for this?

accepted enhancement request

Most helpful comment

After some thought, I've come to agree. Slating for 0.2. My reasoning was that I believed a String being returned coincided with HTML much more often than it did plain text. I'm not sure if that's true or not, but I was convinced with the idea that Rust itself treats &str and String symmetrically, so there's no reason for Rocket not to.

All 2 comments

I would definitely expect both of those to map to text/plain by default.

After some thought, I've come to agree. Slating for 0.2. My reasoning was that I believed a String being returned coincided with HTML much more often than it did plain text. I'm not sure if that's true or not, but I was convinced with the idea that Rust itself treats &str and String symmetrically, so there's no reason for Rocket not to.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marceloboeira picture marceloboeira  路  3Comments

lambda-fairy picture lambda-fairy  路  4Comments

PSeitz picture PSeitz  路  3Comments

lucklove picture lucklove  路  4Comments

denysvitali picture denysvitali  路  3Comments