api: support the expires_in param on all GET requests.
`expires_in` is an alternative to `expiry` that supports durations other than days: * https://danbooru.donmai.us/posts.json?expires_in=30s * https://danbooru.donmai.us/posts.json?expires_in=5min * https://danbooru.donmai.us/posts.json?expires_in=1hour * https://danbooru.donmai.us/posts.json?expires_in=1week * https://danbooru.donmai.us/posts.json?expires_in=1month
This commit is contained in:
@@ -199,6 +199,13 @@ class ApplicationControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal("max-age=#{1.day}, private", response.headers["Cache-Control"])
|
||||
end
|
||||
|
||||
should "support the expires_in parameter" do
|
||||
get posts_path, as: :json, params: { expires_in: "5min" }
|
||||
|
||||
assert_response :success
|
||||
assert_equal("max-age=#{5.minutes}, private", response.headers["Cache-Control"])
|
||||
end
|
||||
|
||||
should "return the correct root element name for empty xml responses" do
|
||||
get tags_path, as: :xml
|
||||
|
||||
|
||||
Reference in New Issue
Block a user