Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-19 15:57:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-19 15:57:54 +0300
commit419c53ec62de6e97a517abd5fdd4cbde3a942a34 (patch)
tree1f43a548b46bca8a5fb8fe0c31cef1883d49c5b6 /spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb
parent1da20d9135b3ad9e75e65b028bffc921aaf8deb7 (diff)
Add latest changes from gitlab-org/gitlab@16-5-stable-eev16.5.0-rc42
Diffstat (limited to 'spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb')
-rw-r--r--spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb b/spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb
index ed1440f23b6..7bc5fd853bf 100644
--- a/spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb
+++ b/spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb
@@ -58,6 +58,39 @@ RSpec.describe Gitlab::Middleware::HandleMalformedStrings do
end
end
+ context 'with POST request' do
+ let(:request_env) do
+ Rack::MockRequest.env_for(
+ '/',
+ method: 'POST',
+ input: input,
+ 'CONTENT_TYPE' => 'application/json'
+ )
+ end
+
+ let(:params) { { method: 'POST' } }
+
+ context 'with valid JSON' do
+ let(:input) { %({"hello": "world"}) }
+
+ it 'returns no error' do
+ env = request_env
+
+ expect(subject.call(env)).not_to eq error_400
+ end
+ end
+
+ context 'with bad JSON' do
+ let(:input) { "{ bad json }" }
+
+ it 'rejects bad JSON with 400 error' do
+ env = request_env
+
+ expect(subject.call(env)).to eq error_400
+ end
+ end
+ end
+
context 'in authorization headers' do
let(:problematic_input) { null_byte }