add content type for html reponses

This commit is contained in:
pavel 2020-09-18 20:18:57 +02:00
parent 430f485998
commit d8add0409c
4 changed files with 10 additions and 0 deletions

View File

@ -200,6 +200,7 @@ module RedmineDmsf
if collection?
html_display
response['Content-Length'] = response.body.bytesize.to_s
response['Content-Type'] = 'text/html'
else
raise Forbidden unless User.current.admin? || User.current.allowed_to?(:view_dmsf_files, project)
response.body = download # Rack based provider

View File

@ -68,6 +68,7 @@ module RedmineDmsf
def get(request, response)
html_display
response['Content-Length'] = response.body.bytesize.to_s
response['Content-Type'] = 'text/html'
OK
end

View File

@ -97,6 +97,7 @@ module RedmineDmsf
def get(request, response)
html_display
response['Content-Length'] = response.body.bytesize.to_s
response['Content-Type'] = 'text/html'
OK
end

View File

@ -41,6 +41,13 @@ class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest
assert_response :success
end
def test_should_include_response_headers
get '/dmsf/webdav', params: nil, headers: @admin
assert_response :success
assert_equal 'text/html', response.headers['Content-Type']
assert response.headers['Content-Length'].to_i > 0, "Content-Length should be > 0, but was #{response.headers['Content-Length']}"
end
def test_should_list_dmsf_enabled_project
get '/dmsf/webdav', params: nil, headers: @admin
assert_response :success