Many fixes

This commit is contained in:
2026-09-14 08:00:08 +00:00
parent 93b012592b
commit 2d970d3123
15 changed files with 338 additions and 176 deletions
+5 -2
View File
@@ -5,12 +5,12 @@ import { toExtendedJson, fromExtendedJson } from '@xo-cash/utils';
import type { Logger } from '../../utils/logger.ts';
import type { ApplicationRequest, ApplicationRouter } from '../router.ts';
import type { StreamResponse } from '../stream/base-stream.ts';
import type { AppEnv, TransportRouter } from './transport-router.ts';
import { ApplicationError, normalizePublicError } from '../../errors/index.ts';
import { HTTP_STATUS_CODE_BAD_REQUEST, HTTP_STATUS_CODE_NO_CONTENT } from '../../constants.ts';
import { HonoSSEStream } from '../stream/hono-sse-stream.ts';
import { HttpRequestStream } from '../stream/http-request-stream.ts';
import { type AppEnv, BaseTransport } from './base-transport.ts';
/** Hono context key where decoded Extended JSON bodies are stored. */
const PARSED_BODY_KEY = 'parsedBody';
@@ -21,7 +21,7 @@ const PARSED_BODY_KEY = 'parsedBody';
* Normal HTTP and SSE both enter the same application router with different
* connection-stream capabilities.
*/
export class HttpTransportRouter implements TransportRouter {
export class HttpTransportRouter extends BaseTransport {
private readonly debug: Logger;
/** SSE connections retained until their final subscription or peer closes. */
@@ -35,6 +35,8 @@ export class HttpTransportRouter implements TransportRouter {
private readonly router: ApplicationRouter,
debug: Logger,
) {
super();
this.debug = debug.extend('http-transport');
}
@@ -111,6 +113,7 @@ export class HttpTransportRouter implements TransportRouter {
return {
path: context.req.path,
...(body === undefined ? {} : { body }),
headers: context.req.header(),
};
}