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)
comment:1 Changed 7 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Ready for checkin|