File tree 2 files changed +4
-9
lines changed
2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { AuthResult, DEFAULT_AUTH_ERROR } from "../../auth/types.js";
20
20
import { logger } from "../../core/Logger.js" ;
21
21
import { getRequestHeader , setResponseHeaders } from "../../utils/headers.js" ;
22
22
import { DEFAULT_CORS_CONFIG } from "../sse/types.js" ;
23
+ import { CORSConfig } from "../sse/types.js" ;
23
24
24
25
function isRequest ( msg : JsonRpcMessage ) : msg is JsonRpcRequest {
25
26
return msg &&
@@ -79,7 +80,7 @@ export class HttpStreamTransport extends AbstractTransport {
79
80
...config ,
80
81
session : { ...DEFAULT_HTTP_STREAM_CONFIG . session , ...config . session } ,
81
82
resumability : { ...DEFAULT_HTTP_STREAM_CONFIG . resumability , ...config . resumability } ,
82
- cors : { ...DEFAULT_CORS_CONFIG , ...( config . cors || { } ) } as Required < NonNullable < HttpStreamTransportConfig [ 'cors' ] > > ,
83
+ cors : { ...DEFAULT_CORS_CONFIG , ...( config . cors || { } ) } as Required < NonNullable < CORSConfig > > ,
83
84
auth : config . auth ?? DEFAULT_HTTP_STREAM_CONFIG . auth ,
84
85
headers : config . headers ?? DEFAULT_HTTP_STREAM_CONFIG . headers ,
85
86
enableGetSse : config . enableGetSse ?? DEFAULT_HTTP_STREAM_CONFIG . enableGetSse ,
Original file line number Diff line number Diff line change @@ -99,13 +99,7 @@ export interface HttpStreamTransportConfig {
99
99
/**
100
100
* CORS configuration
101
101
*/
102
- cors ?: {
103
- allowOrigin ?: string ;
104
- allowMethods ?: string ;
105
- allowHeaders ?: string ;
106
- exposeHeaders ?: string ;
107
- maxAge ?: string ;
108
- } ;
102
+ cors ?: CORSConfig ;
109
103
110
104
/**
111
105
* Authentication configuration
@@ -158,7 +152,7 @@ export interface HttpStreamTransportConfig {
158
152
* Internal configuration type with required fields
159
153
*/
160
154
export type HttpStreamTransportConfigInternal = Required < Omit < HttpStreamTransportConfig , 'headers' | 'auth' | 'cors' | 'session' | 'resumability' > > & {
161
- cors : Required < NonNullable < HttpStreamTransportConfig [ 'cors' ] > > ;
155
+ cors : Required < NonNullable < CORSConfig > > ;
162
156
session : Required < NonNullable < HttpStreamTransportConfig [ 'session' ] > > ;
163
157
resumability : Required < NonNullable < HttpStreamTransportConfig [ 'resumability' ] > > ;
164
158
headers ?: Record < string , string > ;
You can’t perform that action at this time.
0 commit comments