http
http copied to clipboard
Can Http.Receiving not handle data that is more than 1023 byte?
I am trying to track size of received data of http response (Http.Receiving).
Elm codes works fine.
But size
of Http.Receiving
seems to have a problem.
Specifically, size
of Http.Receiving
will be set Nothing
when Content-Length
is more than 1023 byte
.
If Content-Length
smaller than 1024 byte
, it is no problem.
I think event.lengthComputable
returns false
when Content-Length
more than 1023 byte
.
But i don't know why realize so...
https://github.com/elm/http/blob/master/src/Elm/Kernel/Http.js#L183
I wrote following debug print function execute in update
.
printProgress : Http.Progress -> String
printProgress progress =
case progress of
Sending record ->
"Sending: sent=" ++ String.fromInt record.sent
Receiving record ->
"Receiving:"
++ " received="
++ String.fromInt record.received
++ ", size="
++ (Maybe.withDefault -1 record.size |> String.fromInt)
Result of response with 1023 byte
:
- Chrome:
Receiving: received=1023, size=1023: (Loading,<internals>)
- Firefox:
Receiving: received=1023, size=1023: (Loading,<internals>)
Result of response with 1024 byte
:
- Chrome:
Receiving: received=1024, size=-1: (Loading,<internals>)
- Firefox:
Receiving: received=134, size=-1: (Loading,<internals>)
received
has problem too on Firefox.
Is there something workaround?