Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add a spec to ensure the API enforces a Content-Type header otherwise

Aaron Contreras19f265caa78d
diff --git a/spec/requests/api/v3/content_type_header_spec.rb b/spec/requests/api/v3/content_type_header_spec.rb
index d8f0567eae0..45900ea5247 100644
--- a/spec/requests/api/v3/content_type_header_spec.rb
+++ b/spec/requests/api/v3/content_type_header_spec.rb
@@ -62,5 +62,13 @@ RSpec.describe 'API v3 Content-Type header' do
expect(last_response).to be_no_content
end
end
+
+ context 'on any other HTTP method' do
+ it 'responds with a 406 status and a missing Content-Type header message' do
+ patch api_v3_paths.work_package(work_package.id), {}
+ expect(last_response.status).to eq(406)
+ expect(last_response.body).to include('Missing content-type header')
+ end
+ end
end
end