When serving image, return proper Last-Modified header

This commit is contained in:
Piotr Sarnacki 2013-03-11 20:54:24 +01:00
parent 63155e65b6
commit 04bb751b02
2 changed files with 2 additions and 1 deletions

View File

@ -8,7 +8,7 @@ module Travis::Api::App::Responders
headers['Pragma'] = "no-cache"
headers['Expires'] = Time.now.utc.httpdate
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
private

View File

@ -115,6 +115,7 @@ describe 'Repos' do
Factory(:build, repository: repo, state: :passed, commit: on_bar)
result = get('/repos/svenfuchs/minimal.png?branch=foo,bar', {}, headers)
result.should deliver_result_image_for('passing')
result.headers['Last-Modified'].should == repo.last_build_finished_at.httpdate
end
it '"passing" when there is a running build but the previous one has passed' do