Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
29e6b5ce
Commit
29e6b5ce
authored
Apr 27, 2021
by
Dmytro Zaporozhets (DZ)
Committed by
Mark Chao
Apr 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove feature flag api_always_use_application_json [RUN ALL RSPEC] [RUN AS-IF-FOSS]
parent
0293d150
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5 additions
and
52 deletions
+5
-52
changelogs/unreleased/dz-remove-ff-api_always_use_application_json.yml
...released/dz-remove-ff-api_always_use_application_json.yml
+5
-0
config/feature_flags/development/api_always_use_application_json.yml
...ure_flags/development/api_always_use_application_json.yml
+0
-8
doc/api/README.md
doc/api/README.md
+0
-4
lib/api/api.rb
lib/api/api.rb
+0
-26
spec/requests/api/api_spec.rb
spec/requests/api/api_spec.rb
+0
-14
No files found.
changelogs/unreleased/dz-remove-ff-api_always_use_application_json.yml
0 → 100644
View file @
29e6b5ce
---
title
:
Remove feature flag api_always_use_application_json
merge_request
:
56777
author
:
type
:
removed
config/feature_flags/development/api_always_use_application_json.yml
deleted
100644 → 0
View file @
0293d150
---
name
:
api_always_use_application_json
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42229
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/270067
milestone
:
'
13.6'
type
:
development
group
:
group::ecosystem
default_enabled
:
true
doc/api/README.md
View file @
29e6b5ce
...
...
@@ -776,7 +776,3 @@ some API endpoints also support `text/plain`.
In
[
GitLab 13.10 and later
](
https://gitlab.com/gitlab-org/gitlab/-/issues/250342
)
,
API endpoints do not support
`text/plain`
by default, unless it's explicitly documented.
This change is deployed behind the
`:api_always_use_application_json`
[
feature flag
](
../user/feature_flags.md
)
,
enabled by default. On GitLab self-managed instances, GitLab administrators can choose
to
[
disable it
](
../administration/feature_flags.md
)
.
**(FREE SELF)**
lib/api/api.rb
View file @
29e6b5ce
...
...
@@ -130,32 +130,6 @@ module API
formatter
:json
,
Gitlab
::
Json
::
GrapeFormatter
content_type
:json
,
'application/json'
# Remove the `text/plain+deprecated` with `api_always_use_application_json` feature flag
# 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.
# The `+deprecated` is added to distinguish content type
# as defined by `API::API` vs ex. `API::Repositories`
content_type
:txt
,
'text/plain+deprecated'
before
do
# the feature flag workaround is only for `.txt`
api_format
=
env
[
Grape
::
Env
::
API_FORMAT
]
next
unless
api_format
==
:txt
# get all defined content-types for the endpoint
api_endpoint
=
env
[
Grape
::
Env
::
API_ENDPOINT
]
content_types
=
api_endpoint
&
.
namespace_stackable_with_hash
(
:content_types
).
to_h
# Only overwrite `text/plain+deprecated`
if
content_types
[
api_format
]
==
'text/plain+deprecated'
if
Feature
.
enabled?
(
:api_always_use_application_json
,
default_enabled: :yaml
)
content_type
'application/json'
else
content_type
'text/plain'
end
end
end
# Ensure the namespace is right, otherwise we might load Grape::API::Helpers
helpers
::
API
::
Helpers
helpers
::
API
::
Helpers
::
CommonHelpers
...
...
spec/requests/api/api_spec.rb
View file @
29e6b5ce
...
...
@@ -170,20 +170,6 @@ RSpec.describe API::API do
expect
(
response
.
media_type
).
to
eq
(
'application/json'
)
expect
(
response
.
body
).
to
include
(
'{"id":'
)
end
context
'when api_always_use_application_json is disabled'
do
before
do
stub_feature_flags
(
api_always_use_application_json:
false
)
end
it
'returns text/plain'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
media_type
).
to
eq
(
'text/plain'
)
expect
(
response
.
body
).
to
include
(
'#<API::Entities::User:'
)
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment