0001-improved-logged-requests-response-content-type-filte.patch
passerelle/settings.py | ||
---|---|---|
168 | 168 | |
169 | 169 |
# List of LoggedRequest Response Content-Type to log |
170 | 170 |
LOGGED_CONTENT_TYPES_MESSAGES = ( |
171 |
r'text/*', r'application/(json|xml)'
|
|
171 |
r'text/+', r'application/(json|xml)'
|
|
172 | 172 |
) |
173 | 173 | |
174 | 174 |
# Max size of the response to log |
tests/test_loggedrequests.py | ||
---|---|---|
63 | 63 |
assert record.requests_response_content == response.content |
64 | 64 | |
65 | 65 | |
66 |
@pytest.fixture(params=['xml', 'jpeg', 'pdf']) |
|
66 |
@pytest.fixture(params=['xml', 'whatever', 'jpeg', 'pdf'])
|
|
67 | 67 |
def endpoint_response(request): |
68 | 68 |
response_request = mock.Mock( |
69 | 69 |
headers={'Accept': '*/*', 'Authorization': 'Basic dG9rZW46dG9rZW4='}, body=None) |
... | ... | |
71 | 71 |
headers={'Content-Type': 'application/xml; charset=charset=utf-8'}, status_code=200, |
72 | 72 |
content='<tests><test>xml test</test></tests>', request=response_request) |
73 | 73 | |
74 |
whatever = FakedResponse( |
|
75 |
headers={'Content-Type': 'texto/csv'}, status_code=200, |
|
76 |
content='username;age\ntoken;10\ncartman:10', request=response_request) |
|
77 | ||
74 | 78 |
jpeg = FakedResponse( |
75 | 79 |
headers={'Content-Type': 'image/jpeg'}, status_code=200, |
76 | 80 |
content='binary content to be ignored', request=response_request) |
77 |
- |