<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[HTTP Get - Empty response body]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I'm having a really weird issue where the response body of a GET http request is empty but it should have a JSON object.</p>
<p dir="auto">The request is done to a GoPro camera, using the Wifi API, and it's actually works, I can see my GoPro changing the state and the request response is 200, but the body is empty.</p>
<p dir="auto">I have been doing some testing and I found a pretty weird behaviour:</p>
<ul>
<li>Any request to the GoPro API is getting empty body response using UIFlow/Microphyton (while body has content doing the request from my computer).</li>
<li>Serving a GoPro JSON object from my computer it works fine on UIFlow/Microphyton, response has content.</li>
<li>Any requests to my GoPro using Arduino IDE with WifiClient lib is getting the valid json response.</li>
</ul>
<p dir="auto">I'm totally stuck here, not sure if M5Stack firmware or urequest lib has some kind of bug or whats it is happening. Any help is more than welcome :)</p>
<p dir="auto">Thanks!</p>
<p dir="auto">** <a href="https://community.m5stack.com/topic/2053/http-get-empty-response-body/7">Solution</a>? **</p>
]]></description><link>https://community.m5stack.com/topic/2053/http-get-empty-response-body</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 09:36:44 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2053.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Jun 2020 08:04:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HTTP Get - Empty response body on Wed, 08 Jul 2020 16:00:45 GMT]]></title><description><![CDATA[<p dir="auto">So, I could workaround this issue after some work and before close and forget this thread here forever, let me share it:</p>
<p dir="auto"><strong>The problem:</strong></p>
<ul>
<li>GoPro wifi API is not fully following the HTTP protocol specifications.
<ul>
<li>Headers and body content is separated by <strong>\n</strong> instead of <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html" target="_blank" rel="noopener noreferrer nofollow ugc"><strong>\r\n</strong></a></li>
</ul>
</li>
<li>uRequests library is very strict on response parsing, while mostly any other libraries/browser/etc handle requests with some "malformed" bodies, uRequests does not.</li>
</ul>
<p dir="auto"><strong>UIFlow IDE solution:</strong></p>
<ul>
<li>Upload to the Stick5C the <a href="https://github.com/micropython/micropython-lib/pull/393" target="_blank" rel="noopener noreferrer nofollow ugc">modified version of uRequests</a><br />
<img src="/assets/uploads/files/1594223907346-screenshot-2020-07-08-at-17.39.09.png" alt="0_1594223892867_Screenshot 2020-07-08 at 17.39.09.png" class=" img-fluid img-markdown" /></li>
<li>Override the uRequests library usage with a new import using <strong>execute code block</strong>.<br />
<img src="/assets/uploads/files/1594223971529-screenshot-2020-07-08-at-17.37.42.png" alt="0_1594223965368_Screenshot 2020-07-08 at 17.37.42.png" class=" img-fluid img-markdown" /></li>
<li>From that moment on (only on this app) it will use the modified library.</li>
</ul>
<p dir="auto"><strong>No UIFlow IDE solution:</strong></p>
<ul>
<li>Stop using UIFlow IDE 😢</li>
<li>Upload to the Stick5C the <a href="https://github.com/micropython/micropython-lib/pull/393" target="_blank" rel="noopener noreferrer nofollow ugc">modified version of uRequests</a></li>
<li>Use Visual Studio code or any other IDE to continue the development.</li>
<li>Override the uRequests library usage with a new import on the code.</li>
</ul>
<p dir="auto">I hope this is useful to someone else, any suggestion is also more than welcome.</p>
<p dir="auto">Thanks 😄</p>
]]></description><link>https://community.m5stack.com/post/9276</link><guid isPermaLink="true">https://community.m5stack.com/post/9276</guid><dc:creator><![CDATA[jesuslg123]]></dc:creator><pubDate>Wed, 08 Jul 2020 16:00:45 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP Get - Empty response body on Wed, 08 Jul 2020 13:38:00 GMT]]></title><description><![CDATA[<p dir="auto">Just finished to write it down all this and I think I the failed attempt it could work using the <strong>execute code block</strong> to make the import override and keep using the UIFlow IDE 😱 That this makes sense?</p>
<p dir="auto"><strong>New attempt</strong></p>
<ul>
<li>Upload to the Stick5C the <a href="https://github.com/micropython/micropython-lib/pull/393" target="_blank" rel="noopener noreferrer nofollow ugc">modified version of uRequests</a></li>
<li>Keep using UIFlow IDE 🎉</li>
<li>Override the uRequests library usage with a new import on the code using <strong>execute code</strong> block.</li>
</ul>
<p dir="auto">I will try it and update you.</p>
]]></description><link>https://community.m5stack.com/post/9273</link><guid isPermaLink="true">https://community.m5stack.com/post/9273</guid><dc:creator><![CDATA[jesuslg123]]></dc:creator><pubDate>Wed, 08 Jul 2020 13:38:00 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP Get - Empty response body on Wed, 08 Jul 2020 16:01:22 GMT]]></title><description><![CDATA[<p dir="auto"><strong>OLD ANSWER</strong></p>
<p dir="auto">So, I could workaround this issue after some work and before close and forget this thread here forever, let me share it:</p>
<p dir="auto"><strong>The problem:</strong></p>
<ul>
<li>GoPro wifi API is not fully following the HTTP protocol specifications.
<ul>
<li>Headers and body content is separated by <strong>\n</strong> instead of <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html" target="_blank" rel="noopener noreferrer nofollow ugc"><strong>\r\n</strong></a></li>
</ul>
</li>
<li>uRequests library is very strict on response parsing, while mostly any other libraries/browser/etc handle requests with some "malformed" bodies, uRequests does not.</li>
</ul>
<p dir="auto"><s><strong>Failed attempt:</strong></s><br />
<s>- Upload and override the uRequests library include on the Stick5C firmware.</s><br />
<s>- Continue with normality</s></p>
<p dir="auto"><strong>The solution:</strong></p>
<ul>
<li>Stop using UIFlow IDE 😢</li>
<li>Upload to the Stick5C the <a href="https://github.com/micropython/micropython-lib/pull/393" target="_blank" rel="noopener noreferrer nofollow ugc">modified version of uRequests</a></li>
<li>Use Visual Studio code or any other IDE to continue the development.</li>
<li>Override the uRequests library usage with a new import on the code.</li>
</ul>
<p dir="auto">I hope this is useful to someone else, any suggestion is also more than welcome.</p>
<p dir="auto">Thanks :)</p>
]]></description><link>https://community.m5stack.com/post/9272</link><guid isPermaLink="true">https://community.m5stack.com/post/9272</guid><dc:creator><![CDATA[jesuslg123]]></dc:creator><pubDate>Wed, 08 Jul 2020 16:01:22 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP Get - Empty response body on Fri, 19 Jun 2020 18:10:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/robalstona" aria-label="Profile: robalstona">@<bdi>robalstona</bdi></a> said in <a href="/post/9057">HTTP Get - Empty response body</a>:</p>
<blockquote>
<p dir="auto">I use urequests in raw python and i use something like this code below  to parse response (i  delete some unwanted characters by replacing it with empty string)</p>
<p dir="auto">response = urequests.get('http://...')</p>
<h1>if response is a json</h1>
<p dir="auto">data = json.loads(response.text.replace('STRING_TO_REPLACE', 'NEW_STRING')</p>
<h1>other text</h1>
<p dir="auto">data = response.text.replace('STRING_TO_REPLACE', 'NEW_STRING')</p>
</blockquote>
<p dir="auto">The problem is that the library is breaking the response before return it to me. When doing<br />
esponse = urequests.get('http://...')<br />
at that point the response body is already broken, that why I need to customize the library. It in deeper level the issue.</p>
]]></description><link>https://community.m5stack.com/post/9058</link><guid isPermaLink="true">https://community.m5stack.com/post/9058</guid><dc:creator><![CDATA[jesuslg123]]></dc:creator><pubDate>Fri, 19 Jun 2020 18:10:17 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP Get - Empty response body on Fri, 19 Jun 2020 17:32:58 GMT]]></title><description><![CDATA[<p dir="auto">I use urequests in raw python and i use something like this code below  to parse response (i  delete some unwanted characters by replacing it with empty string)</p>
<p dir="auto">response = urequests.get('http://...')</p>
<h1>if response is a json</h1>
<p dir="auto">data = json.loads(response.text.replace('STRING_TO_REPLACE', 'NEW_STRING')</p>
<h1>other text</h1>
<p dir="auto">data = response.text.replace('STRING_TO_REPLACE', 'NEW_STRING')</p>
]]></description><link>https://community.m5stack.com/post/9057</link><guid isPermaLink="true">https://community.m5stack.com/post/9057</guid><dc:creator><![CDATA[robalstona]]></dc:creator><pubDate>Fri, 19 Jun 2020 17:32:58 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP Get - Empty response body on Fri, 19 Jun 2020 17:13:07 GMT]]></title><description><![CDATA[<p dir="auto">I can not edit the post, sorry.</p>
<p dir="auto">Sample of the response bodies:</p>
<p dir="auto">Most common and working</p>
<p dir="auto"><img src="/assets/uploads/files/1592586746683-94870666-555a-4b5b-b9f4-d3075d8db6f9-image.png" alt="0_1592586738340_94870666-555a-4b5b-b9f4-d3075d8db6f9-image.png" class=" img-fluid img-markdown" /><br />
See its use all the time \r\n</p>
<p dir="auto">GoPro sample, and not working</p>
<p dir="auto"><img src="/assets/uploads/files/1592586694296-56dcbd62-936d-4bdc-a48c-f6abac19cfb3-image.png" alt="0_1592586692165_56dcbd62-936d-4bdc-a48c-f6abac19cfb3-image.png" class=" img-fluid img-markdown" /><br />
See it ends with \n\n b'HTTP/1.0 200 OK\r\n</p>
]]></description><link>https://community.m5stack.com/post/9056</link><guid isPermaLink="true">https://community.m5stack.com/post/9056</guid><dc:creator><![CDATA[jesuslg123]]></dc:creator><pubDate>Fri, 19 Jun 2020 17:13:07 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP Get - Empty response body on Fri, 19 Jun 2020 17:07:31 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for your answer, after all day testing I found the issue:</p>
<p dir="auto">The <strong>urequest</strong> library, which is used for the firmware, has an implementation that fails with the GoPro requests due to how it cleans the request body.</p>
<p dir="auto">During the clean up process of the body its split content by <a href="https://github.com/micropython/micropython-lib/blob/master/urequests/urequests.py#L90" target="_blank" rel="noopener noreferrer nofollow ugc"><strong>if not l or l == b"\r\n":</strong></a>,<br />
which probably is ok for most of the requests, but not too flexible or safe, but the GoPro use <strong>\n\n</strong> to split the Content-Type line from the actual body response.</p>
<p dir="auto">So in order to fix the issue, I need to modify the urequests implementation, from:<br />
<strong>if not l or l == b"\r\n":</strong><br />
to<br />
<strong>if not l or l == b"\n" or l == b"\r\n":</strong><br />
with this change, everything works fine.</p>
<p dir="auto">So my question is, it is possible to replace the urequests library included in the firmware with my fork/custom changes? I have seen how to load external libs, but I don't know the path for the urequest lib.</p>
<p dir="auto">Thank you!</p>
]]></description><link>https://community.m5stack.com/post/9055</link><guid isPermaLink="true">https://community.m5stack.com/post/9055</guid><dc:creator><![CDATA[jesuslg123]]></dc:creator><pubDate>Fri, 19 Jun 2020 17:07:31 GMT</pubDate></item><item><title><![CDATA[Reply to HTTP Get - Empty response body on Fri, 19 Jun 2020 12:37:48 GMT]]></title><description><![CDATA[<p dir="auto">Maybe you need set a some parameters in header of your request. like "Content-type". I use <strong>Restler</strong> app on android to testing requests.</p>
]]></description><link>https://community.m5stack.com/post/9050</link><guid isPermaLink="true">https://community.m5stack.com/post/9050</guid><dc:creator><![CDATA[robalstona]]></dc:creator><pubDate>Fri, 19 Jun 2020 12:37:48 GMT</pubDate></item></channel></rss>