Project

General

Profile

Actions

Bug #655

closed

Query part lost when using Net::HTTP.post_form function

Added by klesh (Klesh Wong) over 15 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
should be the latest at that time
Backport:
[ruby-core:19365]

Description

=begin
when posting data by following code:

require 'net/http'
require 'uri'

response = Net::HTTP.post_form URI.parse('http://localhost/api.asp?Action=Check'), {'name'=>'value'}
puts response.body

query part ("Action=Check" in this case) are not attached.
server side receive a request /api.asp without query.

problem could be solved by simple change post_form code:
req = Post.new(url.path)
to
req = Post.new(url.request_uri)

i'm not sure it is a bug or i mis-understand, if i do, is there anyway to post form with query, for i need to deal with some Third Part API.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0