0

this is the code for the jsonp goliath middleware:

https://github.com/postrank-labs/goliath/blob/master/lib/goliath/rack/jsonp.rb

all is fine except the headers contain a content-length less than the actual.

i'm not sure why where or why its setting a content length less than the actual perhaps its because of this:

"#{env.params['callback']}(#{response})" the extra callback method name that is included in the returning body wasn't accounted for.

The solution i could think of is modify the headers before this method post_process is called so the headers content-length would be correct.

im unsure where to do that though.

dB.
  • 4,700
  • 2
  • 46
  • 51
David
  • 4,235
  • 12
  • 44
  • 52

1 Answers1

0

I'm not sure why you'd be seeing that issue but it sounds like a bug. Can you please make a test server that shows the problem and create a bug on github?

The content-length should be set by an auto-injected middleware that sits at the head of the chain. It will run after the JSONP middleware has executed, so it should take the new size into account.

dj2
  • 9,534
  • 4
  • 29
  • 52