Skip to content

Commit

Permalink
Changes permanent redirect status code from 304 to 301. Fixes #242.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgotterer committed Sep 10, 2012
1 parent e5b9422 commit da52e8e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Next Release
============

* [#242](https://github.com/intridea/grape/issues/242): Fix: permanent redirect status. - [@adamgotterer](https://github.com/adamgotterer).
* [#236](https://github.com/intridea/grape/pull/236): Allow validation of nested parameters. - [@tim-vandecasteele](https://github.com/tim-vandecasteele).
* [#201](https://github.com/intridea/grape/pull/201): Added custom exceptions to Grape. Updated validations to use ValidationError that can be rescued. - [@adamgotterer](https://github.com/adamgotterer).
* [#211](https://github.com/intridea/grape/pull/211): Updates to validation and coercion: Fix #211 and force order of operations for presence and coercion - [@adamgotterer](https://github.com/adamgotterer).
Expand Down
2 changes: 1 addition & 1 deletion lib/grape/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def error!(message, status=403)
def redirect(url, options = {})
merged_options = {:permanent => false }.merge(options)
if merged_options[:permanent]
status 304
status 301
else
if env['HTTP_VERSION'] == 'HTTP/1.1' && request.request_method.to_s.upcase != "GET"
status 303
Expand Down
2 changes: 1 addition & 1 deletion spec/grape/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def app; subject end
redirect "/ha", :permanent => true
end
get '/hey'
last_response.status.should eq 304
last_response.status.should eq 301
last_response.headers['Location'].should eq "/ha"
last_response.body.should eq ""
end
Expand Down

0 comments on commit da52e8e

Please sign in to comment.