How to get PUT/POST/PATCH payload data? Details on the flow of res->onData(lambda) please. #1682
-
I'd got GET, HEAD, and OPTIONS (CORS anyone...) kinda covered (I'm far from an expert...). uWebSockets is single threaded by design. And so far, everything looked like straight-line code.
Naively thinking So it looks like this is some kind of continuation, after registering the But that breaks down for me, because my rpc helper (which wraps the And I also read (in the doc or the code, I don't recall), that the Is so, I've need to The last guy asking about Just a high-level description of the code flow for a POST, and details on the lifetime of Update: The |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Req is stack allocated, Res is not. If you want to respond to a POST without doing any allocations (let's say you get all body in one go), you look at the headers and distill the information you need down to X, then you capture X in the onData lambda. But you can also just attach a different lambda with different code based on your headers and URL, then you don't need any X to capture (more than you would either way) |
Beta Was this translation helpful? Give feedback.
Req is stack allocated, Res is not. If you want to respond to a POST without doing any allocations (let's say you get all body in one go), you look at the headers and distill the information you need down to X, then you capture X in the onData lambda.
But you can also just attach a different lambda with different code based on your headers and URL, then you don't need any X to capture (more than you would either way)