On Thu, 26 Mar 2015 08:14:26 -0700 (PDT), Sijie YANG wrote:
> The trailer of HTTP response(in chunked encoding) contains speical header field which records signature of the response body.
>
> How to get the trailer from HTTP responses in javasript?
> I tried xmlHTTPRequest, but the headers(returned by getAllResponseHeaders) doesn't contain any header from the trailer.
>
> Is it possilbe get the raw data of HTTP response in javascript?
>
> Thanks in advanece!
>
> eg:
>
> h=new XMLHttpRequest()
> h.open("GET", "http://test-site", true)
> h.send()
> h.getAllResponseHeaders()
You've created an *asynchronous* request, so you should wait until the
headers are received. Oh, and *do* check the readyState before trying to
access the headers.