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

Requests for Swagger Files Do Not Return Content-Type Header #466

Closed
mikemcdermottredjack opened this issue Sep 29, 2022 · 4 comments
Closed

Comments

@mikemcdermottredjack
Copy link
Contributor

Browsers will typically assume the content-type based upon the file delivered, but we have run into an issue where we have a web client making a misinterpretation based upon the lack of a content-type header.

I believe this can be traced down to this block of code:

HttpResponse::Ok().body(
                                    SWAGGER_DIST
                                        .get_file(filename)
                                        .unwrap_or_else(|| {
                                            panic!("Failed to get file {}", filename)
                                        })
                                        .contents(),

Adding an insert_header that maps the filename to the content-type (assuming sane filenames) could resolve this issue.

@tiagolobocastro
Copy link
Collaborator

Yep that sounds reasonable to me

@mikemcdermottredjack
Copy link
Contributor Author

@shymega
Copy link

shymega commented Oct 14, 2022

Noted that #467 has been merged - does that resolve this issue?

@tiagolobocastro
Copy link
Collaborator

Yes, I believe so.

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

3 participants