server: use status code 403 for disabled features (#24970)

* server: use status code 403 for disabled features

* cont

* fix test case
This commit is contained in:
Xuan-Son Nguyen
2026-06-25 16:36:40 +02:00
committed by GitHub
parent 099bf06952
commit e9d1b76d0a
3 changed files with 27 additions and 4 deletions
+6 -3
View File
@@ -392,11 +392,14 @@ class ToolsStore {
} catch (err) {
const errorMessage = err instanceof Error ? err.message : String(err);
this._error = errorMessage;
// 404 from /tools means the server was started without --tools
if (errorMessage.includes('404') || errorMessage.toLowerCase().includes('not found')) {
// 403 from /tools means the server was started without --tools
// TODO: check status code instead of relying on message
if (errorMessage.includes('this feature is disabled')) {
this._toolsEndpointUnreachable = true;
console.info('[ToolsStore] Built-in tools are disabled on the server');
} else {
console.error('[ToolsStore] Failed to fetch built-in tools:', err);
}
console.error('[ToolsStore] Failed to fetch built-in tools:', err);
} finally {
this._loading = false;
}