• I am working on a RAK8211 module with Espruino 2v01.17

    I have been able to successfully send data using the http module with a "POST" request.
    I am now trying to receive data from a server. To do this I am sending this HTTP request:

    GET /api/v1/devices/configuration HTTP/1.1
    User-Agent: Espruino 2v01.17
    Content-Type: application/json
    Host: serverPath.com

    This is the data I am expecting, and the data that I am actually receiving:

    Expected:

    [{"type":"Positioning","accelerometer":t­rue,"trilateration":true,"globalPosition­ing":true},{"type":"EventCadence","smart­Mode":true},{"type":"Environmental","hum­idity":true,"pressure":true,"temperature­":true,"eventTriggers":true},{"type":"Ac­tions","reboot":false,"dfwUpdate":false,­"findDevice":false}]
    

    Received:

    [{"type":"Positioning","accelerometer":t­rue,"trilateration":true,"globalPosition­ing":true},{"type":"EventCadence","smart­Mode":true},{"type":"Environmental","hum­idity":t
    

    As you can see, the response is truncated.

    I have tried this using both the http.get function and using the http.request function, both results in the same output.

    What is interesting is that the content length is 300, but only 168 characters are printed.
    When I do a print(res.available()) it returns 168

    The response from the server has the following headers:

    HTTP/1.1 200
    Server: nginx/1.12.2
    Date: Tue, 12 Feb 2019 06:28:31 GMT
    Content-Type: application/json;charset=UTF-8
    Content-Length: 300
    Connection: close
    X-Content-Type-Options: nosniff
    X-XSS-Protection: 1; mode=block
    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    Pragma: no-cache
    Expires: 0
    X-Frame-Options: DENY
    

    Why would the available bytes be showing only 168 when the Content-Length is 300 bytes?


    Some more detailed information of things I've tried below:

About

Avatar for Nadnerb @Nadnerb started