In mail "[ruby-talk:29227] HTTP POST"
Jim Menard <jimm / io.com> wrote:
> I'm having a problem with HTTP POST under Ruby 1.6.4 and 1.6.5.
> The code
> always prints an empty body. The response['content-type'] is what I expect
> ("text/html"). However, GET works. When I execute the following code, I see
> the expected response body text.
> I know that the Net::HTTP module is under transition. Is this expected
> behavior?
No. There's something wrong.
Please execute the code below and tell me results.
data = "hello=world"
Net::HTTP.start(HOST, PORT) {|http|
response = http.post2(PATH, data)
p response.code
p response.code_type.body_exist?
p response['Content-Length']
p response['Transfer-Encoding']
p response.body
}
-- Minero Aoki