Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not a ruby expert by any stretch. I also haven't tried to repro this problem in order to verify my results. But after digging through the rack and actionpack code, I might have something.</p> <p>The doc for "rack.input" states: "The input stream is an IO-like object which contains the raw HTTP POST data."</p> <p>So you're using that correctly, it would seem.</p> <p>However, actionpack tries to parse JSON out of the body (if the content type is specified as JSON) and retrieves the body like this:</p> <pre><code>when :json body = request.raw_post </code></pre> <p>where "request" is actionpack's own Request class, and "raw_post" is defined like this:</p> <pre><code>def raw_post unless @env.include? 'RAW_POST_DATA' @env['RAW_POST_DATA'] = body.read(@env['CONTENT_LENGTH'].to_i) body.rewind if body.respond_to?(:rewind) end @env['RAW_POST_DATA'] end </code></pre> <p>and "Request.body" is:</p> <pre><code>def body if raw_post = @env['RAW_POST_DATA'] raw_post.force_encoding(Encoding::BINARY) if raw_post.respond_to?(:force_encoding) StringIO.new(raw_post) else @env['rack.input'] end end </code></pre> <p>That all looks fine and good (though it's confusing to figure out who caches the value first :) ). It looks like the problem is in how the post data is read:</p> <pre><code>@env['RAW_POST_DATA'] = body.read(@env['CONTENT_LENGTH'].to_i) </code></pre> <p>So I'm guessing the problem is that since you change "rack.input" but don't update "CONTENT_LENGTH", actionpack is truncating the data since obviously the zipped content would've been shorter than the unzipped content.</p> <p>Try updating "CONTENT_LENGTH" in your middleware code and see if that fixes it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload