Merge branch '4-add-broadcaster' into 5-add-http-and-sse

This commit is contained in:
2026-08-03 03:15:52 +00:00
2 changed files with 17 additions and 1 deletions
+15
View File
@@ -1,3 +1,18 @@
/**
* Success response status code.
*/
export const HTTP_STATUS_CODE_SUCCESS = 200;
/**
* Created response status code.
*/
export const HTTP_STATUS_CODE_CREATED = 201;
/**
* No content response status code.
*/
export const HTTP_STATUS_CODE_NO_CONTENT = 204;
/**
* HTTP status code for "Not Acceptable" error.
*/
+2 -1
View File
@@ -1,5 +1,6 @@
import type { RouteSendOptions, RouteStream } from '../routes/types.ts';
import type { BaseStream } from './stream/base-stream.ts';
import { HTTP_STATUS_CODE_NO_CONTENT, HTTP_STATUS_CODE_SUCCESS } from '../constants.ts';
/**
* Binds one application request to a connection-level stream.
@@ -44,7 +45,7 @@ export class ApplicationRouteStream implements RouteStream {
await this.connection.send({
...(this.requestId === undefined ? {} : { id: this.requestId }),
type,
statusCode: options.statusCode ?? (data === undefined ? 204 : 200),
statusCode: options.statusCode ?? (data === undefined ? HTTP_STATUS_CODE_NO_CONTENT : HTTP_STATUS_CODE_SUCCESS),
body: data ?? null,
});