Skip to content

Commit

Permalink
More robust handling of content-type in case it has encoding information
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Jan 19, 2012
1 parent ba5abb8 commit daae492
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion oembed/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def convert_to_resource(self, headers, raw_response, params):
if 'content-type' not in headers:
raise OEmbedException('Missing mime-type in response')

if headers['content-type'] in ('text/javascript', 'application/json'):
content_type = headers['content-type'].split(';')[0]

if content_type in ('text/javascript', 'application/json'):
try:
json_response = simplejson.loads(raw_response)
resource = OEmbedResource.create(json_response)
Expand Down

0 comments on commit daae492

Please sign in to comment.