4
4
Bundler . require ( :default , :development )
5
5
6
6
def basic_tests ( url = 'http://127.0.0.1:9292' )
7
- tests ( 'GET /content-length/100' ) do
8
7
9
- Excon . defaults [ :ssl_verify_peer ] = false
10
- connection = Excon . new ( url )
8
+ Excon . defaults [ :ssl_verify_peer ] = false
9
+ connection = Excon . new ( url )
10
+
11
+ tests ( 'GET /content-length/100' ) do
11
12
response = connection . request ( :method => :get , :path => '/content-length/100' )
12
13
13
14
tests ( 'response.status' ) . returns ( 200 ) do
@@ -63,8 +64,6 @@ def basic_tests(url = 'http://127.0.0.1:9292')
63
64
64
65
tests ( 'POST /body-sink' ) do
65
66
66
- connection = Excon . new ( url )
67
-
68
67
tests ( 'response.body' ) . returns ( "5000000" ) do
69
68
response = connection . request ( :method => :post , :path => '/body-sink' , :headers => { 'Content-Type' => 'text/plain' } , :body => 'x' * 5_000_000 )
70
69
response . body
@@ -79,9 +78,12 @@ def basic_tests(url = 'http://127.0.0.1:9292')
79
78
80
79
tests ( 'POST /echo' ) do
81
80
82
- connection = Excon . new ( url )
81
+ tests ( 'without request_block' ) . returns ( 'x' * 100 ) do
82
+ response = connection . request ( :method => :post , :path => '/echo' , :body => 'x' * 100 )
83
+ response . body
84
+ end
83
85
84
- tests ( 'request_block usage ' ) . returns ( 'x' * 100 ) do
86
+ tests ( 'with request_block ' ) . returns ( 'x' * 100 ) do
85
87
data = [ 'x' ] * 100
86
88
request_block = lambda do
87
89
data . shift . to_s
@@ -92,6 +94,23 @@ def basic_tests(url = 'http://127.0.0.1:9292')
92
94
93
95
end
94
96
97
+ tests ( 'PUT /echo' ) do
98
+
99
+ tests ( 'without request_block' ) . returns ( 'x' * 100 ) do
100
+ response = connection . request ( :method => :put , :path => '/echo' , :body => 'x' * 100 )
101
+ response . body
102
+ end
103
+
104
+ tests ( 'request_block usage' ) . returns ( 'x' * 100 ) do
105
+ data = [ 'x' ] * 100
106
+ request_block = lambda do
107
+ data . shift . to_s
108
+ end
109
+ response = connection . request ( :method => :put , :path => '/echo' , :request_block => request_block )
110
+ response . body
111
+ end
112
+
113
+ end
95
114
end
96
115
97
116
def rackup_path ( *parts )
0 commit comments