spec/support/fake_onfido_api.rb in onfido-2.1.0 vs spec/support/fake_onfido_api.rb in onfido-2.1.1
- old
+ new
@@ -7,10 +7,20 @@
before { stub_request(:any, /api.eu.onfido.com/).to_rack(FakeOnfidoAPI) }
end
class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength
+ before do
+ begin
+ if request.content_type == "application/json; charset=utf-8"
+ body_parameters = JSON.parse(request.body.read)
+ params.merge!(body_parameters) if body_parameters
+ end
+ rescue JSON::ParserError
+ end
+ end
+
get '/v3.2/addresses/pick' do
json_response(200, 'addresses.json')
end
post '/v3.2/applicants' do
@@ -153,10 +163,9 @@
get '/v3.2/webhooks/:id' do
json_response(200, 'webhook.json')
end
delete '/v3.2/webhooks/:id' do
- content_type 'application/json; charset=utf-8'
status 204
end
get '/v3.2/webhooks' do
json_response(200, 'webhooks.json')