We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 47db56e commit 6fa2406Copy full SHA for 6fa2406
1 file changed
src/internals/StreamHttpReply.cpp
@@ -121,9 +121,13 @@ String ArduinoHttpServer::StreamHttpErrorReply::getHtmlBody(const String& data)
121
122
String ArduinoHttpServer::StreamHttpErrorReply::getJsonBody(const String& data)
123
{
124
+ // Copy string since replace modifies original.
125
+ String dataCopy(data);
126
+ dataCopy.replace("\"", "\\\"");
127
+
128
String body;
129
body += "{\"Error\": \"";
- body += data.replace("\"", "\\\"");
130
+ body +=dataCopy;
131
body += "\"}";
132
133
return body;
0 commit comments