Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

when creating requests with #new the http_method wasn't set properly

  • Loading branch information...
commit 5cbfbf7f8010ebadbba828806b9451d5dc97bd4d 1 parent 4755285
John-Paul Bader authored

Showing 2 changed files with 13 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 lib/rig/http_header.rb
  2. +11 0 test/test_http.rb
4 lib/rig/http_header.rb
@@ -2,8 +2,8 @@ module Rig
2 2 class HTTPHeader < Hash
3 3
4 4 def initialize options
5   - http_method = options[:http_method]
6   - path = options[:path]
  5 + http_method = options[:http_method] || "GET"
  6 + path = options[:path] || "/"
7 7
8 8 header = {
9 9 "" => "#{http_method} #{path} HTTP/1.1",
11 test/test_http.rb
@@ -223,6 +223,17 @@ class TestHttp < Test::Unit::TestCase
223 223 assert_equal false, request.body.multipart?
224 224 end
225 225
  226 + test "simple request in full manual mode" do
  227 + request = Rig::HTTP.new( "http://github.com:80/hukl" )
  228 + expected = "GET /hukl HTTP/1.1\r\n" \
  229 + "Host: github.com\r\n" \
  230 + "Origin: localhost\r\n" \
  231 + "Content-Length: 0\r\n" \
  232 + "Content-Type: text/plain\r\n" \
  233 + "Connection: close\r\n\r\n"
  234 + assert_equal expected, request.header.to_s
  235 + end
  236 +
226 237 #test "multipart body gets properly created" do
227 238 # post = HTTP.new(
228 239 # :host => "localhost",

0 comments on commit 5cbfbf7

Please sign in to comment.
Something went wrong with that request. Please try again.