-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Description
Hi,
Currently ESP8266WebServer::client() returns a WiFiClient by value, which forbids passing the result directly to a function taking a Client&.
For example, it causes a compilation error with ArduinoJson:
serializeJson(doc, server.client());Because serializeJson() takes a Print&, the line above produces the following error:
no instance of overloaded function "serializeJson" matches the argument list -- argument types are: (ArduinoJson6141_0000010::StaticJsonDocument<768U>, WiFiServer::ClientType)
To fix this problem, ESP8266WebServer::client() must return a reference (and not a copy), just as HTTPClient::getStream() does.
(see also this question on StackOverflow)
Best regards,
Benoit
d-a-v, edgar-bonet and TheNitek
Metadata
Metadata
Assignees
Labels
No labels