Skip to content

Commit

Permalink
Correct content length for crossbar CSV response
Browse files Browse the repository at this point in the history
The Content-Length header was incorrect before - though I'm not sure why. This works as intended.
I know this is potentially inefficient, but if the CSV response is expected to be large then it will probably be chunked anyway.
  • Loading branch information
kalda341 committed Mar 3, 2016
1 parent fd1d65e commit 17b887e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion applications/crossbar/src/api_resource.erl
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ to_csv(Req, Context) ->
_ ->
RespBody = maybe_flatten_jobj(Context1),
RespHeaders1 = [{<<"Content-Type">>, <<"application/octet-stream">>}
,{<<"Content-Length">>, iolist_size(RespBody)}
,{<<"Content-Length">>, size(wh_util:to_binary(RespBody))/8}
,{<<"Content-Disposition">>, <<"attachment; filename=\"data.csv\"">>}
| cb_context:resp_headers(Context1)
],
Expand Down

0 comments on commit 17b887e

Please sign in to comment.