Skip to content

Commit

Permalink
change transport override keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
karen-stepanyan committed Apr 11, 2024
1 parent 04f464e commit 03253bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/adapter/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ export class AdapterEndpoint<T extends EndpointGenerics> implements AdapterEndpo
const rawRequestBody = req.body as unknown as { data: AdapterRequestData }
const requestOverrides = rawRequestBody.data?.overrides?.[this.adapterName.toLowerCase()]
// Transport override
if (requestOverrides?.['__TRANSPORT__']) {
return requestOverrides['__TRANSPORT__']
if (requestOverrides?.['transport']) {
return requestOverrides['transport']
}
return rawRequestBody.data?.transport
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export interface AdapterMetricsMeta {
export type Overrides = {
[adapterName: string]: {
[symbol: string]: string
__TRANSPORT__: string
transport: string
}
}

Expand Down
6 changes: 3 additions & 3 deletions test/transports/routing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ test.serial('transport override routes to correct Transport', async (t) => {
transport: 'websocket',
overrides: {
test: {
__TRANSPORT__: 'batch',
transport: 'batch',
},
},
})
Expand Down Expand Up @@ -740,7 +740,7 @@ test.serial('invalid transport override is skipped', async (t) => {
overrides: {
// Invalid adapter name
XXXX: {
__TRANSPORT__: 'batch',
transport: 'batch',
},
},
})
Expand Down Expand Up @@ -809,7 +809,7 @@ test.serial(
transport: 'sse',
overrides: {
test: {
__TRANSPORT__: 'websocket',
transport: 'websocket',
},
},
})
Expand Down

0 comments on commit 03253bc

Please sign in to comment.