mirror of
https://github.com/sprockets/sprockets.mixins.http.git
synced 2024-11-15 03:00:29 +00:00
Tests _http_resp_deserialize() with a response that lacks a Content-Type
header.
This commit is contained in:
parent
259f6e30e7
commit
3842ef8792
1 changed files with 14 additions and 0 deletions
14
tests.py
14
tests.py
|
@ -1,3 +1,4 @@
|
|||
import io
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
@ -413,3 +414,16 @@ class MixinTestCase(testing.AsyncHTTPTestCase):
|
|||
client = httpclient.AsyncHTTPClient()
|
||||
self.assertEqual(client.max_clients, 25)
|
||||
|
||||
@testing.gen_test()
|
||||
def test_missing_content_type(self):
|
||||
# Craft a response that lacks a Content-Type header.
|
||||
request = httpclient.HTTPRequest(
|
||||
self.get_url('/test?foo=bar&status_code=200'))
|
||||
response = httpclient.HTTPResponse(
|
||||
request, code=200, headers={},
|
||||
buffer=io.StringIO('Do not try to deserialize me.'))
|
||||
# Try to deserialize that response. It should not raise an exception.
|
||||
try:
|
||||
response_body = self.mixin._http_resp_deserialize(response)
|
||||
except KeyError:
|
||||
self.fail('http_fetch raised KeyError!')
|
||||
|
|
Loading…
Reference in a new issue