[fix](trx-frontend-http): handle plain GET on /audio endpoint
Return 204 for non-WebSocket GET requests to /audio instead of letting actix-ws reject with 400. This allows the browser's audio availability probe to work correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -50,6 +50,11 @@ pub async fn audio_ws(req: HttpRequest, body: web::Payload) -> Result<HttpRespon
|
||||
return Ok(HttpResponse::NotFound().body("audio not enabled"));
|
||||
};
|
||||
|
||||
// Plain GET probe (no WebSocket upgrade) — return 204 to signal audio is available
|
||||
if !req.headers().contains_key("upgrade") {
|
||||
return Ok(HttpResponse::NoContent().finish());
|
||||
}
|
||||
|
||||
let mut rx_sub = ch.rx.subscribe();
|
||||
let tx_sender = ch.tx.clone();
|
||||
let mut info_rx = ch.info.clone();
|
||||
|
||||
Reference in New Issue
Block a user