From f9fe028eff15aee2bc86b1698f8f8e992c215de6 Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Fri, 2 Aug 2013 14:04:43 +0200 Subject: [PATCH] Fix issue #11 in the pecan adapter --- tests/pecantest/test/tests/test_ws.py | 2 +- wsmeext/pecan.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/pecantest/test/tests/test_ws.py b/tests/pecantest/test/tests/test_ws.py index d494348..bd5c704 100644 --- a/tests/pecantest/test/tests/test_ws.py +++ b/tests/pecantest/test/tests/test_ws.py @@ -126,4 +126,4 @@ class TestWS(FunctionalTest): def test_no_content_type_if_no_return_type(self): res = self.app.delete('/authors/4') - assert "Content-Type" not in res.headers + assert "Content-Type" not in res.headers, res.headers['Content-Type'] diff --git a/wsmeext/pecan.py b/wsmeext/pecan.py index 59c2fc5..f8390b0 100644 --- a/wsmeext/pecan.py +++ b/wsmeext/pecan.py @@ -86,6 +86,11 @@ def wsexpose(*args, **kwargs): pecan.response.status = 500 return data + if funcdef.return_type is None: + pecan.request.pecan['content_type'] = None + pecan.response.content_type = None + return '' + return dict( datatype=funcdef.return_type, result=result