Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # When performing a redirect, this callback will be executed first. If the callback
- # returns true, then the redirect is followed, otherwise it is not. The request that
- # triggered the redirect and the response will be passed into the block. This can be
- # used to update any links on the client side.
- #
- # Example:
- #
- # author_resource.on_redirect do |req, resp|
- # post.author_uri = resp.header['Location']
- # end
- #
- # @block callback<request, response>
- # The action to be executed when a request results in a redirect. Yields the
- # current request and result objects to the callback.
- def on_redirect(&callback)
- if block_given?
- @on_redirect = callback
- else
- @on_redirect
- end
- end
Add Comment
Please, Sign In to add comment