Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept put requests #70

Merged
merged 4 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/webrick/httpservlet/prochandler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def do_GET(request, response)
end

alias do_POST do_GET
alias do_PUT do_GET
# :startdoc:
end

Expand Down
19 changes: 19 additions & 0 deletions test/webrick/test_httpserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -540,4 +540,23 @@ def test_big_chunks
end
}
end

def test_accept_put_requests
TestWEBrick.start_httpserver {|server, addr, port, log|
server.mount_proc("/", lambda {|req, res|
res.status = 200
assert_equal("abcde", req.body)
})
Thread.pass while server.status != :Running

Net::HTTP.start(addr, port) do |http|
req = Net::HTTP::Put.new("/")
req.body = "abcde"
http.request(req){|res|
assert_equal("200", res.code)
}
server.shutdown
end
}
end
end