mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-19 00:07:38 +00:00
toradio, fromradio OPTIONS handler: fix sending proper HTTP response. (#9322)
Before this (missing response): $ curl -v -X OPTIONS http://meshtastic.local/api/v1/fromradio * Host meshtastic.local:80 was resolved. * IPv6: (none) * IPv4: 192.168.0.19 * Trying 192.168.0.19:80... * Connected to meshtastic.local (192.168.0.19) port 80 * using HTTP/1.x > OPTIONS /api/v1/fromradio HTTP/1.1 > Host: meshtastic.local > User-Agent: curl/8.14.1 > Accept: */* > * Request completely sent off * Empty reply from server * shutting down connection #0 curl: (52) Empty reply from server After this (proper HTTP 204 response): $ curl -v -X OPTIONS http://meshtastic.local/api/v1/fromradio * Host meshtastic.local:80 was resolved. * IPv6: (none) * IPv4: 192.168.0.19 * Trying 192.168.0.19:80... * Connected to meshtastic.local (192.168.0.19) port 80 * using HTTP/1.x > OPTIONS /api/v1/fromradio HTTP/1.1 > Host: meshtastic.local > User-Agent: curl/8.14.1 > Accept: */* > * Request completely sent off < HTTP/1.1 204 OK < Content-Type: application/x-protobuf < Access-Control-Allow-Origin: * < Access-Control-Allow-Methods: GET < X-Protobuf-Schema: https://raw.githubusercontent.com/meshtastic/protobufs/master/meshtastic/mesh.proto < * Connection #0 to host meshtastic.local left intact This is related to https://github.com/meshtastic/firmware/issues/5385. Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -173,7 +173,7 @@ void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res)
|
||||
|
||||
if (req->getMethod() == "OPTIONS") {
|
||||
res->setStatusCode(204); // Success with no content
|
||||
// res->print(""); @todo remove
|
||||
res->print("");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ void handleAPIv1ToRadio(HTTPRequest *req, HTTPResponse *res)
|
||||
|
||||
if (req->getMethod() == "OPTIONS") {
|
||||
res->setStatusCode(204); // Success with no content
|
||||
// res->print(""); @todo remove
|
||||
res->print("");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user