Skip to content

Commit b5b6d48

Browse files
committed
Merge pull request #243 from adamgotterer/master
Updates permanent redirect status code from 304 to 301
2 parents e5b9422 + da52e8e commit b5b6d48

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Next Release
22
============
33

4+
* [#242](https://github.com/intridea/grape/issues/242): Fix: permanent redirect status. - [@adamgotterer](https://github.com/adamgotterer).
45
* [#236](https://github.com/intridea/grape/pull/236): Allow validation of nested parameters. - [@tim-vandecasteele](https://github.com/tim-vandecasteele).
56
* [#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).
67
* [#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).

lib/grape/endpoint.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def error!(message, status=403)
159159
def redirect(url, options = {})
160160
merged_options = {:permanent => false }.merge(options)
161161
if merged_options[:permanent]
162-
status 304
162+
status 301
163163
else
164164
if env['HTTP_VERSION'] == 'HTTP/1.1' && request.request_method.to_s.upcase != "GET"
165165
status 303

spec/grape/endpoint_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def app; subject end
268268
redirect "/ha", :permanent => true
269269
end
270270
get '/hey'
271-
last_response.status.should eq 304
271+
last_response.status.should eq 301
272272
last_response.headers['Location'].should eq "/ha"
273273
last_response.body.should eq ""
274274
end

0 commit comments

Comments
 (0)