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

Poor error message for invalid mime types #21

Open
GoogleCodeExporter opened this issue Feb 9, 2016 · 0 comments
Open

Poor error message for invalid mime types #21

GoogleCodeExporter opened this issue Feb 9, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

mhaase@ubuntu:~$ python
Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimeparse
>>> mimeparse.best_match(['text/plain', 'application/json'], 'foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/mimeparse.py", line 153, in best_match
    parsed_header = [parse_media_range(r) for r in split_header]
  File "/usr/local/lib/python2.7/dist-packages/mimeparse.py", line 67, in parse_media_range
    (type, subtype, params) = parse_mime_type(range)
  File "/usr/local/lib/python2.7/dist-packages/mimeparse.py", line 48, in parse_mime_type
    (type, subtype) = full_type.split('/')
ValueError: need more than 1 value to unpack


What is the expected output? What do you see instead?

There should be a specific type of exception indicating a malformed content 
type.

What version of the product are you using? On what operating system?

>>> mimeparse.__version__
'0.1.4'

Original issue reported on code.google.com by [email protected] on 11 Jun 2013 at 9:14

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

No branches or pull requests

1 participant