[Zope-dev] REQUEST object -> where's the body?

Chris Withers chrisw@nipltd.com
Wed, 07 Aug 2002 10:06:07 +0100


Hi Michael,

Michael Beaulieu wrote:
> I'd like to get the body from a HTTP Request ( method="POST" )
> 
> ( I'm trying to submit data but not with a browser...)
> 
> 
> Can anybody tell me how to get the body?
> 
> I'm trying to set the request like this:
> 
> req.putHeader("Content-Length",str(len(some_string)) )
> req.endHeaders()
> .
> .
> req.send(some_string)

A few points ;-)

1. This question is better directed to zope@zope.org

2. You should be manipulating the response, not the request.

3. If you want to write to the response body, then I think you want:

response.write(...)

...but be very careful that your total content length matches what you set in 
Content-Length...

cheers,

Chris