File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,8 @@ void loop() {
179
179
const char * method = req[" method" ];
180
180
auto param = req[" param" ];
181
181
182
+ bool notFound = false ;
183
+
182
184
if (strcmp (method, " set_rgbw" ) == 0 ) {
183
185
if (param[" time" ]) {
184
186
state.transitionTime = param[" time" ].as <unsigned long >();
@@ -204,16 +206,20 @@ void loop() {
204
206
} else if (strcmp (method, " get_info" ) == 0 ) {
205
207
res[" mac" ] = MAC_ADDRESS;
206
208
} else {
209
+ notFound = true ;
210
+ }
211
+
212
+ if (notFound) {
207
213
client.println (" HTTP/1.1 404 Not Found" );
208
214
client.println (" Connection: close" );
209
215
client.println ();
210
- }
211
-
212
- client.println (" HTTP/1.1 200 OK " );
213
- client.println (" Connection: close " );
214
- client. println ();
215
- if (! res. isNull ()) {
216
- serializeJson (res, client);
216
+ } else {
217
+ client. println ( " HTTP/1.1 200 OK " );
218
+ client.println (" Connection: close " );
219
+ client.println ();
220
+ if (!res. isNull ()) {
221
+ serializeJson ( res, client);
222
+ }
217
223
}
218
224
} else {
219
225
client.println (" HTTP/1.1 404 Not Found" );
You can’t perform that action at this time.
0 commit comments