WebServer Methods Questions #7656
Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
-
For question 4, I would like to say if you are using Question 5 may be solved by yourself if you can directly see the source code. For the part where you say how to trigger So, assuming I may not be correct, but this is what I have understood so far. Any mistakes please point them out because I am still learning. Thanks. |
Beta Was this translation helpful? Give feedback.
-
I'm looking to better understand what is going on with a few of the WebServer library methods.
Referring to the WebUpdate example:
Regarding the
send()
methods:send()
? (Assuming no calls tosendHeader()
have been made previously.)Regarding
sendHeader(const String& name, const String& value, bool first = false)
method.first
parameter? Does it change the order of elements assembled by previoussendHeader()
calls?Edit: In looking at WebServer.cpp, confirming that
first
sets this header at the top of the response header string.Regarding
on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn)
here:As used in line 30, it has 4 parameters.
For the
method
parameter, most examples useHTTP_POST
orHTTP_GET
. What do these expand to and where are they enumerated?Trying to understand the 4th parameter,
ufn
. It seems to be the function called to handle file uploads. But under what conditions, or what triggers it to be called instead of the 3rd parameter,fn
?In the example,
fn
is called afterufn
returns? but don't see what triggers that call, since the entireon
statement is only executed if the endpoint is matched and is of typeHTTP_POST
.Why prefer that method over using
onFileUpload(THandlerFunction fn)
? hereLooks like WebServer might be a candidate for refactoring as per #6759, but in the meantime any insight would be appreciated.
@igrr @SuGlider
Beta Was this translation helpful? Give feedback.
All reactions