grape_sinatra_helpers 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -112,7 +112,7 @@ module GrapeSinatraHelpers
|
|
|
112
112
|
header 'ETag', value
|
|
113
113
|
|
|
114
114
|
if etag_matches? request.env['HTTP_IF_NONE_MATCH'], new_resource
|
|
115
|
-
|
|
115
|
+
safe_request? ? error!('304 Not Modified', 304) : error!('412 Precondition Failed', 412)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
if request.env['HTTP_IF_MATCH']
|
|
@@ -152,6 +152,10 @@ module GrapeSinatraHelpers
|
|
|
152
152
|
raise ArgumentError, "unable to convert #{value.inspect} to a Time object"
|
|
153
153
|
end
|
|
154
154
|
|
|
155
|
+
def safe_request?
|
|
156
|
+
request.get? or request.head? or request.options? or request.trace?
|
|
157
|
+
end
|
|
158
|
+
|
|
155
159
|
end
|
|
156
160
|
end
|
|
157
161
|
|