Skip to content

Commit 25ed8e6

Browse files
committed
fix: Fixes ESLint 'no-case-declarations' error in HTTP transport by adding block scope to the default switch case.
1 parent aa46eb8 commit 25ed8e6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/transports/http/server.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,15 @@ export class HttpStreamTransport extends AbstractTransport {
186186
case "POST": await this.handlePost(req, res); break;
187187
case "GET": await this.handleGet(req, res); break;
188188
case "DELETE": await this.handleDelete(req, res); break;
189-
default:
190-
const allowHeader = this._config.enableGetSse ?
191-
'GET, POST, DELETE, OPTIONS' :
189+
default: { // Add block scope for the default case
190+
const allowHeader = this._config.enableGetSse ?
191+
'GET, POST, DELETE, OPTIONS' :
192192
'POST, DELETE, OPTIONS';
193-
res.writeHead(405, { 'Content-Type': 'text/plain', 'Allow': allowHeader });
193+
res.writeHead(405, { 'Content-Type': 'text/plain', 'Allow': allowHeader });
194194
res.end("Method Not Allowed");
195-
logger.warn(`Unsupported method: ${req.method}`);
195+
logger.warn(`Unsupported method: ${req.method}`);
196196
break;
197+
} // Close block scope
197198
}
198199
} catch (error: any) {
199200
logger.error(`Error processing ${req.method} ${url.pathname}: ${error.message}`);

0 commit comments

Comments
 (0)