When serving image, return proper Last-Modified header
This commit is contained in:
parent
63155e65b6
commit
04bb751b02
|
@ -8,7 +8,7 @@ module Travis::Api::App::Responders
|
||||||
headers['Pragma'] = "no-cache"
|
headers['Pragma'] = "no-cache"
|
||||||
headers['Expires'] = Time.now.utc.httpdate
|
headers['Expires'] = Time.now.utc.httpdate
|
||||||
headers['Content-Disposition'] = %(inline; filename="#{File.basename(filename)}")
|
headers['Content-Disposition'] = %(inline; filename="#{File.basename(filename)}")
|
||||||
halt send_file(filename, type: :png)
|
halt send_file(filename, type: :png, last_modified: resource.last_build_finished_at)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -115,6 +115,7 @@ describe 'Repos' do
|
||||||
Factory(:build, repository: repo, state: :passed, commit: on_bar)
|
Factory(:build, repository: repo, state: :passed, commit: on_bar)
|
||||||
result = get('/repos/svenfuchs/minimal.png?branch=foo,bar', {}, headers)
|
result = get('/repos/svenfuchs/minimal.png?branch=foo,bar', {}, headers)
|
||||||
result.should deliver_result_image_for('passing')
|
result.should deliver_result_image_for('passing')
|
||||||
|
result.headers['Last-Modified'].should == repo.last_build_finished_at.httpdate
|
||||||
end
|
end
|
||||||
|
|
||||||
it '"passing" when there is a running build but the previous one has passed' do
|
it '"passing" when there is a running build but the previous one has passed' do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user