Commit 421980f
fix(instance): return 200 with disconnected status instead of 400 on #20
GET /instance/status was calling ensureClientConnected, which returns
an error when the WhatsApp client exists but is not connected (e.g.
after the user manually removes the device from their phone).
This caused the endpoint to return HTTP 400 until the container was
restarted, making it impossible for clients to detect the disconnected
state without restarting the server.
Status is a read-only query: it should report the current state, not
require an active connection to do so. The fix reads clientPointer
directly and returns Connected=false/LoggedIn=false when the client
is nil or disconnected, without attempting reconnection.
Fixes #201 parent d1ff63e commit 421980f
1 file changed
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
381 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
382 | 386 | | |
383 | 387 | | |
384 | 388 | | |
| |||
391 | 395 | | |
392 | 396 | | |
393 | 397 | | |
394 | | - | |
| 398 | + | |
395 | 399 | | |
396 | 400 | | |
397 | 401 | | |
398 | 402 | | |
399 | | - | |
400 | | - | |
401 | | - | |
| 403 | + | |
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| |||
0 commit comments