optimus_prime 4.2.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93b4506c14103891ac41d093d4cdbe7fd91ddfba
4
- data.tar.gz: 06684c6422755e5823ee7a3d57570332c5ad1b59
3
+ metadata.gz: 7b6365a199bb6594f027e72700c64d92e5119f91
4
+ data.tar.gz: 1557be78f6e4123878c749875cde8593c52f9e37
5
5
  SHA512:
6
- metadata.gz: 7af00a76f3f77e393444c860fac755b6a8585023fb57dec780ac080f44f41dce37f0d16a49bcb7adf0dc834bd4a050f640c2577e04c0d29e335bb91c022954a7
7
- data.tar.gz: 841e4e8de2804ec5a59f48dbd17e31320b37f9d485ce2deaaaf9d3517ee0329012511639668295cc78296b2cb438c99e3dd0084f32ca017f9d45bb574b7155ed
6
+ metadata.gz: bce4f71a302e6dfb4b86b2b398a7dffab84878d6ef08983345a41921b7d0e365765b864fa8032c404acff537f7b27bd085ea234b64f069eadb17518047cf4c8f
7
+ data.tar.gz: 74aaff1bddfefcdd2f5c000d55f8ffac6c2ada3efd0ccba49511d2581bafe359029ad0bade7c8eb9793f5dc25f9ea7245f5ce7615cf4b73dff2fd852d1aa1c3a
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -156,8 +156,9 @@ module OptimusPrime
156
156
  requests[path][:count] += 1
157
157
  cookies = request.cookies
158
158
  cookies.merge!(CGI::Cookie::parse(env["HTTP_X_COOKIES"]))
159
+ custom_params = env["HTTP_X_PARAMS"]
159
160
 
160
- request_made = { method: self.env["REQUEST_METHOD"], body: body, headers: { content_type: request.content_type, accept: request.accept, cookies: cookies } }
161
+ request_made = { method: self.env["REQUEST_METHOD"], body: body, headers: { content_type: request.content_type, accept: request.accept, cookies: cookies, custom_params: custom_params } }
161
162
  @@requests[path][:last_request] = request_made
162
163
  end
163
164
 
@@ -1,3 +1,3 @@
1
1
  module OptimusPrime
2
- VERSION = "4.2.0"
2
+ VERSION = "4.3.0"
3
3
  end
data/optimus_prime.log CHANGED
@@ -13073,3 +13073,182 @@ Listening on 0.0.0.0:7003, CTRL+C to stop
13073
13073
  /Users/saturn/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
13074
13074
  /Users/saturn/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
13075
13075
  Exiting!
13076
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13077
+ Using rack adapter
13078
+ Thin web server (v1.6.3 codename Protein Powder)
13079
+ Debugging ON
13080
+ Maximum connections set to 1024
13081
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13082
+ Exiting!
13083
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13084
+ Using rack adapter
13085
+ Thin web server (v1.6.3 codename Protein Powder)
13086
+ Debugging ON
13087
+ Maximum connections set to 1024
13088
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13089
+ Exiting!
13090
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13091
+ Using rack adapter
13092
+ Thin web server (v1.6.3 codename Protein Powder)
13093
+ Debugging ON
13094
+ Maximum connections set to 1024
13095
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13096
+ Exiting!
13097
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13098
+ Using rack adapter
13099
+ Thin web server (v1.6.3 codename Protein Powder)
13100
+ Debugging ON
13101
+ Maximum connections set to 1024
13102
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13103
+ Exiting!
13104
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13105
+ Using rack adapter
13106
+ Thin web server (v1.6.3 codename Protein Powder)
13107
+ Debugging ON
13108
+ Maximum connections set to 1024
13109
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13110
+ JSON::ParserError - 757: unexpected token at 'status=YES':
13111
+ /Users/saturn/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse'
13112
+ /Users/saturn/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse'
13113
+ /Users/saturn/dev/optimus_prime/lib/optimus_prime/server.rb:177:in `parse_request'
13114
+ /Users/saturn/dev/optimus_prime/lib/optimus_prime/server.rb:88:in `block in <class:Server>'
13115
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
13116
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `block in compile!'
13117
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
13118
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
13119
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
13120
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
13121
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
13122
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
13123
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
13124
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
13125
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
13126
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
13127
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
13128
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
13129
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
13130
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
13131
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
13132
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
13133
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
13134
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
13135
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
13136
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
13137
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
13138
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
13139
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
13140
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
13141
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
13142
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
13143
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
13144
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
13145
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
13146
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
13147
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
13148
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
13149
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
13150
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
13151
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
13152
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
13153
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
13154
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
13155
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
13156
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
13157
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
13158
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
13159
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
13160
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/controllers/controller.rb:87:in `start'
13161
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/runner.rb:200:in `run_command'
13162
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/runner.rb:156:in `run!'
13163
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/bin/thin:6:in `<top (required)>'
13164
+ /Users/saturn/.rvm/gems/ruby-2.1.1/bin/thin:23:in `load'
13165
+ /Users/saturn/.rvm/gems/ruby-2.1.1/bin/thin:23:in `<main>'
13166
+ /Users/saturn/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
13167
+ /Users/saturn/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
13168
+ Exiting!
13169
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13170
+ Using rack adapter
13171
+ Thin web server (v1.6.3 codename Protein Powder)
13172
+ Debugging ON
13173
+ Maximum connections set to 1024
13174
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13175
+ Exiting!
13176
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13177
+ Using rack adapter
13178
+ Thin web server (v1.6.3 codename Protein Powder)
13179
+ Debugging ON
13180
+ Maximum connections set to 1024
13181
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13182
+ Exiting!
13183
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13184
+ Using rack adapter
13185
+ Thin web server (v1.6.3 codename Protein Powder)
13186
+ Debugging ON
13187
+ Maximum connections set to 1024
13188
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13189
+ Exiting!
13190
+ Writing PID to /Users/saturn/dev/optimus_prime/tmp/pids/optimus_prime.pid
13191
+ Using rack adapter
13192
+ Thin web server (v1.6.3 codename Protein Powder)
13193
+ Debugging ON
13194
+ Maximum connections set to 1024
13195
+ Listening on 0.0.0.0:7003, CTRL+C to stop
13196
+ JSON::ParserError - 757: unexpected token at 'status=YES':
13197
+ /Users/saturn/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse'
13198
+ /Users/saturn/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `parse'
13199
+ /Users/saturn/dev/optimus_prime/lib/optimus_prime/server.rb:177:in `parse_request'
13200
+ /Users/saturn/dev/optimus_prime/lib/optimus_prime/server.rb:88:in `block in <class:Server>'
13201
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
13202
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `block in compile!'
13203
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
13204
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
13205
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
13206
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
13207
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
13208
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
13209
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
13210
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
13211
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
13212
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
13213
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
13214
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
13215
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
13216
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
13217
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
13218
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
13219
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
13220
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
13221
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
13222
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
13223
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
13224
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
13225
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
13226
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
13227
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
13228
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
13229
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
13230
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
13231
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
13232
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
13233
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
13234
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
13235
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
13236
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
13237
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
13238
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
13239
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
13240
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
13241
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
13242
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
13243
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
13244
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
13245
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
13246
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/controllers/controller.rb:87:in `start'
13247
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/runner.rb:200:in `run_command'
13248
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/lib/thin/runner.rb:156:in `run!'
13249
+ /Users/saturn/.rvm/gems/ruby-2.1.1/gems/thin-1.6.3/bin/thin:6:in `<top (required)>'
13250
+ /Users/saturn/.rvm/gems/ruby-2.1.1/bin/thin:23:in `load'
13251
+ /Users/saturn/.rvm/gems/ruby-2.1.1/bin/thin:23:in `<main>'
13252
+ /Users/saturn/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
13253
+ /Users/saturn/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
13254
+ Exiting!
@@ -14,6 +14,15 @@ describe OptimusPrime do
14
14
  expect( op.prime("test").status ).to eq 201
15
15
  end
16
16
 
17
+ it "records the custom X-Params header" do
18
+ op.prime('custom-x-params', '{}', content_type: :json)
19
+
20
+ ::Faraday.new("http://localhost:7003").tap {|c| c.headers = { "X-Params" => { test: true }.to_json } }.get('/get/custom-x-params')
21
+ response = op.last_request_for('custom-x-params')
22
+
23
+ expect(response["headers"]["custom_params"]).to eq({ test: true }.to_json)
24
+ end
25
+
17
26
  it "records the custom X-Cookies header" do
18
27
  op.prime('custom-x-header', '{}', content_type: :json)
19
28
 
@@ -209,32 +218,32 @@ describe OptimusPrime do
209
218
  it "GET" do
210
219
  op.prime("continue", { username: "Test" }.to_json, content_type: :json)
211
220
  ::Faraday.get("http://localhost:7003/get/continue", nil, { "Content-Type" => "application/json", "Accept" => "application/json" })
212
- expect( op.last_request_for("continue") ).to eq({ "method" => "GET", "body" => {}, "headers" => { "content_type" => "application/json", "accept" => ["application/json"], "cookies" => {} } })
221
+ expect( op.last_request_for("continue") ).to eq({ "method" => "GET", "body" => {}, "headers" => { "content_type" => "application/json", "accept" => ["application/json"], "cookies" => {}, "custom_params" => nil } })
213
222
  end
214
223
 
215
224
  it "POST" do
216
225
  op.prime("kermit", { username: "Test" }.to_json, content_type: :json)
217
226
  ::Faraday.post("http://localhost:7003/get/kermit", { username: "Test" }.to_json)
218
- expect( op.last_request_for("kermit") ).to eq({ "method" => "POST", "body" => { "username" => "Test" }, "headers"=>{ "content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"], "cookies" => {}} })
227
+ expect( op.last_request_for("kermit") ).to eq({ "method" => "POST", "body" => { "username" => "Test" }, "headers"=>{ "content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"], "cookies" => {}, "custom_params" => nil } })
219
228
  end
220
229
 
221
230
  it "PUT" do
222
231
  op.prime("put/kermit", { username: "Test" }.to_json, content_type: :json)
223
232
  ::Faraday.put("http://localhost:7003/get/put/kermit", { username: "Test" }.to_json)
224
- expect( op.last_request_for("put/kermit") ).to eq({"method"=>"PUT", "body"=>{"username"=>"Test"}, "headers"=>{"content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"], "cookies" => {} }})
233
+ expect( op.last_request_for("put/kermit") ).to eq({"method"=>"PUT", "body"=>{"username"=>"Test"}, "headers"=>{"content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"], "cookies" => {}, "custom_params" => nil }})
225
234
  end
226
235
 
227
236
  it "returns a decoded body" do
228
237
  op.prime("kermit", { username: "Test" }.to_json, content_type: :json)
229
238
  ::Faraday.post("http://localhost:7003/get/kermit", { word: "with spaces and other shit" }.to_json)
230
- expect( op.last_request_for("kermit") ).to eq({"method"=>"POST", "body"=>{"word"=>"with spaces and other shit"}, "headers"=>{"content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"], "cookies" => {} }})
239
+ expect( op.last_request_for("kermit") ).to eq({"method"=>"POST", "body"=>{"word"=>"with spaces and other shit"}, "headers"=>{"content_type"=>"application/x-www-form-urlencoded", "accept"=>["*/*"], "cookies" => {}, "custom_params" => nil }})
231
240
  end
232
241
 
233
242
  it "tries for up to 0.1 seconds to get the last request" do
234
243
  op = OptimusPrime::Base.new(wait_for: 0.1)
235
244
  op.prime("waitMan", { status: "waiting" }.to_json, content_type: :json)
236
245
  Thread.new { sleep(0.01); ::Faraday.get("http://localhost:7003/get/waitMan", nil, { "Content-Type" => "application/json", "Accept" => "application/json" })}
237
- expect( op.last_request_for("waitMan") ).to eq({ "method" => "GET", "body" => {}, "headers" => { "content_type" => "application/json", "accept" => ["application/json"], "cookies" => {} } })
246
+ expect( op.last_request_for("waitMan") ).to eq({ "method" => "GET", "body" => {}, "headers" => { "content_type" => "application/json", "accept" => ["application/json"], "cookies" => {}, "custom_params" => nil } })
238
247
  end
239
248
 
240
249
  it "returns the last request as nil if it doesn't find a request after 0.1 seconds" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimus_prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Nalesso
metadata.gz.sig CHANGED
Binary file