Commit 757e69b4 authored by Stan Hu's avatar Stan Hu

Merge branch...

Merge branch 'philipcunningham-strip-newlines-from-http-response-in-dast-site-validation-321219' into 'master'

Strip trailing whitespace from validation response

See merge request gitlab-org/gitlab!53951
parents 486e9740 5e58f552
......@@ -41,7 +41,7 @@ module DastSiteValidations
case dast_site_validation.validation_strategy
when 'text_file'
response.content_type == 'text/plain' && response.body == token
response.content_type == 'text/plain' && response.body.rstrip == token
when 'header'
response.headers[DastSiteValidation::HEADER] == token
else
......
---
title: Strip trailing whitespace from DAST site validation HTTP response body
merge_request: 53951
author:
type: changed
......@@ -129,6 +129,14 @@ RSpec.describe DastSiteValidations::ValidateService do
it_behaves_like 'a validation'
context 'when the http response body has trailing newlines after the token' do
let(:token) { dast_site_validation.dast_site_token.token + "\n\n" }
it 'does not raise an exception' do
expect { subject }.not_to raise_error(DastSiteValidations::ValidateService::TokenNotFound)
end
end
context 'when content type is incorrect' do
let(:headers) { { 'Content-Type' => 'text/html; charset=UTF-8' } }
......
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