Skip to content

Commit

Permalink
FI-2487: Revert "FI-2318 Allow for form data at session create endpoi…
Browse files Browse the repository at this point in the history
…nt (#429)" (#451)

This reverts commit 5c35cf6.
  • Loading branch information
Jammjammjamm authored Feb 12, 2024
1 parent 651c959 commit 8026b28
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
4 changes: 1 addition & 3 deletions lib/inferno/apps/web/controllers/test_sessions/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class Create < Controller

def handle(req, res)
params = req.params.to_h
if req.body.string.present? && req.env['CONTENT_TYPE']&.include?('application/json')
params.merge!(JSON.parse(req.body.string).symbolize_keys)
end
params.merge!(JSON.parse(req.body.string).symbolize_keys) unless req.body.string.blank?

session = repo.create(create_params(params))

Expand Down
4 changes: 0 additions & 4 deletions spec/request_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def post_json(path, data)
post path, data.to_json, 'CONTENT_TYPE' => 'application/json'
end

def post_form_data(path, data)
post path, data, 'CONTENT_TYPE' => 'multipart/form-data'
end

def parsed_body
JSON.parse(last_response.body)
end
Expand Down
12 changes: 0 additions & 12 deletions spec/requests/test_sessions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@
expect(persisted_session.suite_options).to eq(expected_options)
end
end

context 'with form data' do
it 'renders the test session json' do
post_form_data create_path, input

expect(last_response.status).to eq(200)

expect(parsed_body).to include(*response_fields)
expect(parsed_body['id']).to be_present
expect(parsed_body['test_suite_id']).to eq(test_suite_id)
end
end
end

context 'with invalid input' do
Expand Down

0 comments on commit 8026b28

Please sign in to comment.