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

Add default content_type for TempFile uploads #2769

Closed
2 tasks done
mark-e-hoffman opened this issue Apr 8, 2024 · 2 comments
Closed
2 tasks done

Add default content_type for TempFile uploads #2769

mark-e-hoffman opened this issue Apr 8, 2024 · 2 comments
Labels
request Request for new functionality

Comments

@mark-e-hoffman
Copy link

What's missing?

I have a Rocket application accepting a multi-part-form with a file attachment. The files will also be of type octet-stream but if the caller does not specify this when posting ( python example in particular ), the temp_file has no content_type and the size of the data saved is incorrect. Examples with curl work properly since the content_type is added.

Ideal Solution

Add a configuration option, much limits, to indicate the default content_type for a TempFile if not specified by the caller.

Why can't this be implemented outside of Rocket?

Not really

Are there workarounds usable today?

The only work around is to force the caller to always specify content_type for the attachment.

Alternative Solutions

No response

Additional Context

No response

System Checks

  • I do not believe that this feature can or should be implemented outside of Rocket.
  • I was unable to find a previous request for this feature.
@mark-e-hoffman mark-e-hoffman added the request Request for new functionality label Apr 8, 2024
@SergioBenitez
Copy link
Member

the temp_file has no content_type and the size of the data saved is incorrect

That's not correct, so I suspect this is matter of writing code that does one thing when expecting it to do another.

Can you provide some other of test case or example, in actual code, that does one thing where you'd like it to do another?

@SergioBenitez
Copy link
Member

Closing due to inactivity.

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

No branches or pull requests

2 participants