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

Allow overriding content-type after set_body_{bytes,json,string} #63

Open
JakubKoralewski opened this issue Mar 28, 2021 · 1 comment
Open

Comments

@JakubKoralewski
Copy link

The call to insert_header does nothing here:

let followed_page = ResponseTemplate::new(200)
	.set_body_string(followed_page_html)
	.insert_header("content-type", "text/html");

and instead requires doing this:

let followed_page = ResponseTemplate::new(200)
	.set_body_raw(followed_page_html.as_bytes(), "text/html; charset=utf-8");

I think this is confusing. Defaults are fine I guess, but it's weird that I can't set content-type to whatever I please to overwrite it.

Related

@95th
Copy link
Contributor

95th commented Jan 2, 2022

Also, should the set_body_json really set the mimetype? A user should be able to set their own value anyway.

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

No branches or pull requests

2 participants