forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to asynchttpserver form data/body broken with nim-lang#13147
This fix add a new server option that allow the request body to be processed outside the asynchttpserver library to break big files into chunks of data. This change does not break anything and works with the jester and the rosencrantz. The new server option "stream" when it is true uses the Future Streams otherwise all body is readed at once. The "stream" option by default is set to false. The idea of this option I took from the python requests module (https://requests.readthedocs.io/en/v1.2.3/api/). "When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can take place." Example: let server = newAsyncHttpServer(stream = true) # if true use Future Streams waitFor server.serve(Port(8080), cb)
- Loading branch information
Showing
1 changed file
with
19 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters