Merge branch '3-add-routing' into 4-add-broadcaster
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user