Commit 47bfd782 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch...

Merge branch 'blackst0ne-rails5-expected-the-response-to-have-status-code-ok-but-it-was-404' into 'master'

Resolve "[Rails5] expected the response to have status code :ok but it was 404"

Closes #48008

See merge request gitlab-org/gitlab-ce!19937
parents 95753b5e c48e7dc2
...@@ -7,6 +7,7 @@ class Projects::ArtifactsController < Projects::ApplicationController ...@@ -7,6 +7,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
before_action :authorize_read_build! before_action :authorize_read_build!
before_action :authorize_update_build!, only: [:keep] before_action :authorize_update_build!, only: [:keep]
before_action :extract_ref_name_and_path before_action :extract_ref_name_and_path
before_action :set_request_format, only: [:file]
before_action :validate_artifacts! before_action :validate_artifacts!
before_action :entry, only: [:file] before_action :entry, only: [:file]
...@@ -101,4 +102,12 @@ class Projects::ArtifactsController < Projects::ApplicationController ...@@ -101,4 +102,12 @@ class Projects::ArtifactsController < Projects::ApplicationController
render_404 unless @entry.exists? render_404 unless @entry.exists?
end end
def set_request_format
request.format = :html if set_request_format?
end
def set_request_format?
request.format != :json
end
end end
---
title: "[Rails5] Set request.format for artifacts_controller"
merge_request: 19937
author: "@blackst0ne"
type: fixed
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