Test client encode_file doesn't set content-type properly
|Reported by:||notanumber||Owned by:||notanumber|
|Cc:||varikin@…||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The test client doesn't properly set the content-type when uploading files. It hard-codes the content-type value to to 'application/octet-stream'. This makes it difficult to test that code that relies on a specific content-type being set.
The encode_file method could be easily changed to make use of mimetypes.guess_type to make a best guess attempt to set a content-type, falling back to the default 'application/octet-stream'.
I've attached a patch that does this.
Change History (11)
Changed 7 years ago by notanumber
comment:1 Changed 6 years ago by SmileyChris
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Ready for checkin
comment:3 Changed 6 years ago by notanumber
- Owner changed from nobody to notanumber
- Status changed from new to assigned
Changed 6 years ago by notanumber
Changed 6 years ago by lomin
comment:7 Changed 5 years ago by russellm
- Resolution set to fixed
- Status changed from assigned to closed