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

Data loss caused by header overwrite #56

Open
Mubelotix opened this issue May 17, 2021 · 3 comments
Open

Data loss caused by header overwrite #56

Mubelotix opened this issue May 17, 2021 · 3 comments
Milestone

Comments

@Mubelotix
Copy link
Contributor

Minreq is currently unable to handle headers appearing multiple times in the response.
Only the last value is stored, as it is inserted over the previous values.

headers.insert(header, value);

@neonmoe
Copy link
Owner

neonmoe commented May 17, 2021

Yep, this is planned for 3.0, since it would require changing the Response struct's public API.

@Mubelotix
Copy link
Contributor Author

Great! I need a quick fix so I will do it myself but it would be great if that could benefit to other users too. I could do a PR. How would you prefer to solve this? Using a custom HeaderMap like reqwest did or using a HashMap<String, Vec<String>>?

@neonmoe
Copy link
Owner

neonmoe commented May 17, 2021

I haven't given it much thought. Reqwest's solution certainly makes for a clean API, but I fear that would require quite a bit of code, and I'd rather keep minreq as simple as possible. I think a HashMap<String, Vec<String>> would be good if combined with a convenience function for Response, e.g. Response::get_header(key: &str) -> Option<&str>, which would just return the first header, if any.

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

Successfully merging a pull request may close this issue.

2 participants