Commit 0860a9b7 by liyijie

Support formData

parent 89a8130e
...@@ -216,12 +216,14 @@ module RSpec ...@@ -216,12 +216,14 @@ module RSpec
headers = builder.headers headers = builder.headers
env = builder.env env = builder.env
body = builder.body body = builder.body
form_data = builder.form_data
# Run the request # Run the request
params = body || form_data
if ::Rails::VERSION::MAJOR >= 5 if ::Rails::VERSION::MAJOR >= 5
self.send(method, path, {params: body, headers: headers, env: env}) self.send(method, path, {params: params, headers: headers, env: env})
else else
self.send(method, path, body, headers.merge(env)) self.send(method, path, params, headers.merge(env))
end end
if example.metadata[:capture_examples] if example.metadata[:capture_examples]
......
...@@ -104,6 +104,10 @@ module RSpec ...@@ -104,6 +104,10 @@ module RSpec
instance.send(key.split('&').last).to_json instance.send(key.split('&').last).to_json
end end
end end
def form_data
parameter_values('formData')
end
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment