Page 1 of 1

featherweb

Posted: Sat Apr 11, 2020 3:33 am
by jrichard82
I needed a lite weight web app framework for my project. I started with picoweb; however my device would frequently run out of memory and my apps would stop responding... assuming it was running out of memory. There was alot of memory churn going on and I am not really certain all of the details - so I wrote featherweb. It brought memory consumption in my project WAY down (12-15KB additonal memory)! Feel free to throw stones at it.. :ugeek:

https://github.com/jason-richards/featherweb

Re: featherweb

Posted: Sun Apr 26, 2020 1:24 pm
by jumasheff
Hey, thank you for your library!

One thing I couldn't figure out is that when we use request.send() it sends `200 NA` status, vs `200 OK`. I tried to set a `200 OK` with `request.status = '200 OK'` but it started showing `200 OK NA` when I checked with Postman.

Browsers and Postman are ok with that, but not an Arduino http client :(

Re: featherweb

Posted: Sun Apr 26, 2020 5:30 pm
by jumasheff
Well, after playing with this I understood that it didn't matter. But couldn't get why after sending GET request from an arduino to esp8266, my endpoints stop sending responses, but if I reset the board and send get requests from a browser, keeps working ok. I tried to increase timeout up to 10, but it didn't help so far.

Re: featherweb

Posted: Mon Apr 27, 2020 5:13 pm
by jrichard82
jumasheff: I am not familiar with the arduino http client. I am happy to change the library to accommodate a better default response. For my application its inconsequential. Are you giving the run call a callback? What does the callback return? If false or no return the default is to exit the handler...

EDIT: yeah that should of been 200 OK :lol:

Re: featherweb

Posted: Mon Apr 27, 2020 5:38 pm
by jrichard82
Wouldn't be too hard to check the status code in the default response and return the right thing for the handful of common cases (various 200's, 400's, or 500's. Probably wouldn't impact memory consumption... worthwhile?

Re: featherweb

Posted: Wed Apr 29, 2020 8:03 pm
by jrichard82
jumasheff: Made some changes to give the user more control over status, content-type and response headers. Now gives the default reason for most status codes...