-
Notifications
You must be signed in to change notification settings - Fork 31
Server headers, FormData, some docs improvements and fix for bug in ChunkedResponse #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If possible, please test the impact of these changes to request processing speed. In theory there should not be much overhead, but in my testing I noticed a very big range (80ms-500ms). Although this might be caused by my WiFi and the connection itself, it we be great it anyone could eliminate the possibility that it is the code's fault. Thanks in advance. 🙂 |
examples/httpserver_form_data.py
Outdated
enctype = request.query_params.get("enctype", "text/plain") | ||
|
||
if request.method == POST: | ||
posted_value = request.data.get("something") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an exception here for request not having property data
I think maybe this is supposed to be form_data
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, this should be form_data
. Already fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me.
I've retested all modified examples on a Feather S3 TFT with the latest versions.
Really great new functionality and improved docstrings. Thanks @michalpokusa!
Updating https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch to 1.4.9 from 1.4.8: > Merge pull request adafruit/Adafruit_CircuitPython_FocalTouch#26 from adafruit/ladyada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MAX9744 to 1.2.15 from 1.2.14: > Merge pull request adafruit/Adafruit_CircuitPython_MAX9744#17 from kbsriram/add-typing Updating https://github.com/adafruit/Adafruit_CircuitPython_Nunchuk to 1.1.9 from 1.1.8: > Merge pull request adafruit/Adafruit_CircuitPython_Nunchuk#31 from adafruit/stemma_i2c Updating https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display to 3.12.0 from 3.11.3: > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#114 from makermelissa/master Updating https://github.com/adafruit/Adafruit_CircuitPython_Seesaw to 1.14.0 from 1.13.0: > Merge pull request adafruit/Adafruit_CircuitPython_seesaw#118 from ladyada/main Updating https://github.com/adafruit/Adafruit_CircuitPython_asyncio to 0.5.23 from 0.5.22: > Merge pull request adafruit/Adafruit_CircuitPython_asyncio#44 from furbrain/main > Merge pull request adafruit/Adafruit_CircuitPython_asyncio#42 from tekktrik/dev/fix-build-bundle Updating https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer to 4.1.0 from 4.0.2: > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#59 from FoamyGuy/ethernet_example > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#58 from michalpokusa/server-headers Updating https://github.com/adafruit/Adafruit_CircuitPython_NTP to 3.0.10 from 3.0.9: > Merge pull request adafruit/Adafruit_CircuitPython_NTP#30 from joshua-beck-0908/timezone_fix Updating https://github.com/adafruit/Adafruit_CircuitPython_PortalBase to 1.14.9 from 1.14.8: > Merge pull request adafruit/Adafruit_CircuitPython_PortalBase#92 from makermelissa/main Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
PR does not contain any breaking changes, I suggest publishing it as 4.1.0.
⭐ Added:
FormData
class andRequest.form_data
for parsing POST body for"application/x-www-form-urlencoded"
,"multipart/form-data"
,"text/plain"
content types.Server.headers
for setting headers that are sent with every response, without need for explicitly adding them in constructor.Server.poll()
return value that indicates the result of polling e.g.NO_REQUEST
orREQUEST_HANDLED_RESPONSE_SENT
.🛠️ Updated:
ChunkedResponse
sending empty chunk was breaking functionality, because it ended response prematurely.Server.stopped
is set toTrue
in constructor, it changes toFalse
only after calling.start()
.server_forever()
.🏗️ Refactor:
query_params
andform_data
to use_IFieldStorage
for shared functionality.