Commit f5b92f55 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Dmytro Zaporozhets

Introduce API content type feature flag

When enabled APi will use json as default content type.
Requires application restart to take effect.
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Signed-off-by: default avatarDmytro Zaporozhets <dzaporozhets@gitlab.com>
parent 25cfc674
---
name: api_json_content_type
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42229
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/270067
group: group::ecosystem
type: development
default_enabled: false
......@@ -115,7 +115,14 @@ module API
format :json
formatter :json, Gitlab::Json::GrapeFormatter
content_type :txt, "text/plain"
# There is a small chance some users depend on the old behavior.
# We this change under a feature flag to see if affects GitLab.com users.
if Feature.enabled?(:api_json_content_type)
content_type :json, 'application/json'
else
content_type :txt, 'text/plain'
end
# Ensure the namespace is right, otherwise we might load Grape::API::Helpers
helpers ::API::Helpers
......
......@@ -5,6 +5,8 @@ module API
class Runner < Grape::API::Instance
helpers ::API::Helpers::Runner
content_type :txt, 'text/plain'
resource :runners do
desc 'Registers a new Runner' do
success Entities::RunnerRegistrationDetails
......
......@@ -9,6 +9,8 @@ module API
MODULE_VERSION_REQUIREMENTS = { module_version: MODULE_VERSION_REGEX }.freeze
content_type :txt, 'text/plain'
before { require_packages_enabled! }
helpers do
......
......@@ -6,6 +6,8 @@ module API
class Repositories < Grape::API::Instance
include PaginationParams
content_type :txt, 'text/plain'
helpers ::API::Helpers::HeadersHelpers
before { authorize! :download_code, user_project }
......
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