Personally, I reckon that if a response shouldn't contain any content, then it stands to reason that a content-type header is pointless (why tell the browser what type of data the non-existent content has?). As such, I'd imagine the interpretation is strict but valid.
Regards, Domhnall. 2009/1/21 Chris Miles <[email protected]> > > I have a simple Pylons controller that responds to PUT requests with a > 204 (No Content) status and no entity body. For example (stripped > down):: > > class DataController(BaseController): > def test_put(self): > do_something() > response.status = "204" # No content > return None > > The functional test (using webtest) fails on this action with:: > > AssertionError: Content-Type header found in a 204 response, which > must not return content. > > because Pylons is including a default Content-Type in the response > ("content-type: text/html; charset=utf-8"). > > I can avoid the error by explicitly removing the Content-Type header > from the response (del response.headers['content-type']) but this > seems unnecessary. > > Either Pylons or Webtest are at fault with their understanding of > whether a Content-Type header is allowed with a 204 response. > > In webtest it is lint.py:check_content_type() that enforces a 204 > response to contain no Content-Type header. While I agree a Content- > Type is unnecessary for a response containing no body, I can't see > anywhere in rfc2616 that dictates including a Content-Type header is > invalid. > > Anyone care to make a call one way or the other? Otherwise I'll > submit a Webtest ticket/patch. > > Cheers, > Chris Miles > > > > > -- Quidquid latine dictum sit, altum sonatur. (Whatever is said in Latin sounds profound) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
