response from GET request is truncated (RAK8211) #7280
Replies: 1 comment
-
Posted at 2019-02-12 by Nadnerb Using http.get():
Results:
Using http.request:
Results:
I also tried concatenating a string with each data that is returned:
Results:
Posted at 2019-02-12 by @gfwilliams Can you try just going with what's done in all the examples? http://www.espruino.com/Internet Eg. remove
I believe by doing the read you may be pulling data out that should be going to the But basically: The callback for get/request gets called after the header is received - and not when all data has come in. It's then up to you to add a The reasoning is it's pretty common for HTTP requests to send more data than would fit in the device's RAM, so by leaving the handling of the data up to you, you can decide what is done with it. Posted at 2019-02-13 by Nadnerb I forgot to mention that I had tried that one too.
Results:
I only added the "manual read" after it failed the first time, just to see if I could force it to read all 300 characters, which didnt work either because theres only 168 bytes available. Posted at 2019-02-13 by Nadnerb I turned on debug statements in the lower level code (QuectelBC95.js) and there seems to be an issue there. I'll take a look at that instead. Posted at 2019-02-13 by @gfwilliams Ok - what's your full code? https://www.espruino.com/RAK8211 says you should be using Are you definitely using firmware 2v01? I seem to recall there was some issue like this with one of the RAK boards in the past but I was pretty sure it got fixed. Posted at 2019-02-13 by Nadnerb Hi Gordon, The low level code that we've written in this file is what is causing issues, specifically in the receive handler. So its nothing with Espruino that is the issue. I have figured out a solution now, by using the "+NSONMI" receive handler to output the number of bytes received and then retrieve them at a later time using "AT+NSORF", rather than retrieve them in the receive handler itself. Thanks for your help. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-02-12 by Nadnerb
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:
This is the data I am expecting, and the data that I am actually receiving:
Expected:
Received:
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:
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:
Beta Was this translation helpful? Give feedback.
All reactions