This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle_gzip_params | |
# When the server receives a request with content-type "gzip/json" this will be called which will unzip it, | |
# and then parse it as json | |
# The use case is so clients such as Android or Iphone can zip their long request such as Inviters#addressbook emails | |
# Then the server can unpack the request and parse the parameters as normal. | |
if request.content_type == "gzip/json" | |
data = ActiveSupport::JSON.decode(ActiveSupport::Gzip.decompress(request.raw_post)) | |
data = {:_json => data} unless data.is_a?(Hash) | |
params ||= {} |