@@ -10,13 +10,11 @@ import {
1010} from './kilo-chat' ;
1111
1212const TOKEN = 'expected-gateway-token' ;
13- const SANDBOX_ID = 'sbx_test' ;
1413
1514function makeApp ( fetchImpl : typeof fetch ) {
1615 const app = new Hono ( ) ;
1716 registerKiloChatSendRoute ( app , {
1817 expectedToken : TOKEN ,
19- sandboxId : SANDBOX_ID ,
2018 apiToken : 'api_token' ,
2119 baseUrl : 'https://chat.example.test' ,
2220 fetchImpl,
@@ -52,7 +50,7 @@ describe('POST /_kilo/kilo-chat/send', () => {
5250 expect ( res . status ) . toBe ( 401 ) ;
5351 } ) ;
5452
55- it ( 'forwards authorized requests with sandbox id header and api token ' , async ( ) => {
53+ it ( 'forwards authorized requests with api token only; no x-kilo-sandbox-id header ' , async ( ) => {
5654 let capturedUrl = '' ;
5755 let capturedInit : RequestInit | undefined ;
5856 const fetchImpl = ( async ( url : string | URL , init ?: RequestInit ) => {
@@ -80,7 +78,7 @@ describe('POST /_kilo/kilo-chat/send', () => {
8078 expect ( capturedUrl ) . toBe ( 'https://chat.example.test/v1/messages' ) ;
8179 const headers = new Headers ( capturedInit ?. headers ) ;
8280 expect ( headers . get ( 'authorization' ) ) . toBe ( 'Bearer api_token' ) ;
83- expect ( headers . get ( 'x-kilo-sandbox-id' ) ) . toBe ( SANDBOX_ID ) ;
81+ expect ( headers . get ( 'x-kilo-sandbox-id' ) ) . toBeNull ( ) ;
8482 const body = JSON . parse ( ( capturedInit ?. body as string ) ?? '{}' ) ;
8583 expect ( body ) . toEqual ( { conversationId : 'c1' , text : 'hi' } ) ;
8684 } ) ;
@@ -106,7 +104,6 @@ function makeEditApp(fetchImpl: typeof fetch) {
106104 const app = new Hono ( ) ;
107105 registerKiloChatEditRoute ( app , {
108106 expectedToken : TOKEN ,
109- sandboxId : SANDBOX_ID ,
110107 apiToken : 'api_token' ,
111108 baseUrl : 'https://chat.example.test' ,
112109 fetchImpl,
@@ -156,7 +153,7 @@ describe('PATCH /_kilo/kilo-chat/messages/:id', () => {
156153 expect ( capturedInit ?. method ) . toBe ( 'PATCH' ) ;
157154 const headers = new Headers ( capturedInit ?. headers ) ;
158155 expect ( headers . get ( 'authorization' ) ) . toBe ( 'Bearer api_token' ) ;
159- expect ( headers . get ( 'x-kilo-sandbox-id' ) ) . toBe ( SANDBOX_ID ) ;
156+ expect ( headers . get ( 'x-kilo-sandbox-id' ) ) . toBeNull ( ) ;
160157 expect ( JSON . parse ( ( capturedInit ?. body as string ) ?? '{}' ) ) . toEqual ( {
161158 conversationId : 'c1' ,
162159 text : 'Hel' ,
@@ -186,7 +183,6 @@ function makeDeleteApp(fetchImpl: typeof fetch) {
186183 const app = new Hono ( ) ;
187184 registerKiloChatDeleteRoute ( app , {
188185 expectedToken : TOKEN ,
189- sandboxId : SANDBOX_ID ,
190186 apiToken : 'api_token' ,
191187 baseUrl : 'https://chat.example.test' ,
192188 fetchImpl,
@@ -227,15 +223,14 @@ describe('DELETE /_kilo/kilo-chat/messages/:id', () => {
227223 expect ( capturedInit ?. method ) . toBe ( 'DELETE' ) ;
228224 const headers = new Headers ( capturedInit ?. headers ) ;
229225 expect ( headers . get ( 'authorization' ) ) . toBe ( 'Bearer api_token' ) ;
230- expect ( headers . get ( 'x-kilo-sandbox-id' ) ) . toBe ( SANDBOX_ID ) ;
226+ expect ( headers . get ( 'x-kilo-sandbox-id' ) ) . toBeNull ( ) ;
231227 } ) ;
232228} ) ;
233229
234230function makeTypingApp ( fetchImpl : typeof fetch ) {
235231 const app = new Hono ( ) ;
236232 registerKiloChatTypingRoute ( app , {
237233 expectedToken : TOKEN ,
238- sandboxId : SANDBOX_ID ,
239234 apiToken : 'api_token' ,
240235 baseUrl : 'https://chat.example.test' ,
241236 fetchImpl,
@@ -296,7 +291,7 @@ describe('POST /_kilo/kilo-chat/typing', () => {
296291 expect ( capturedUrl ) . toBe ( 'https://chat.example.test/v1/conversations/c1/typing' ) ;
297292 const headers = new Headers ( capturedInit ?. headers ) ;
298293 expect ( headers . get ( 'authorization' ) ) . toBe ( 'Bearer api_token' ) ;
299- expect ( headers . get ( 'x-kilo-sandbox-id' ) ) . toBe ( SANDBOX_ID ) ;
294+ expect ( headers . get ( 'x-kilo-sandbox-id' ) ) . toBeNull ( ) ;
300295 expect ( capturedInit ?. method ) . toBe ( 'POST' ) ;
301296 } ) ;
302297
@@ -363,7 +358,6 @@ describe('POST /_kilo/kilo-chat/messages/:id/reactions', () => {
363358
364359 registerKiloChatReactionPostRoute ( app , {
365360 expectedToken : 'gw' ,
366- sandboxId : 'sbx' ,
367361 apiToken : 'api' ,
368362 baseUrl : 'http://svc' ,
369363 fetchImpl,
@@ -380,7 +374,7 @@ describe('POST /_kilo/kilo-chat/messages/:id/reactions', () => {
380374 expect ( calls [ 0 ] . url ) . toBe ( 'http://svc/v1/messages/MID/reactions' ) ;
381375 const headers = calls [ 0 ] . init . headers as Record < string , string > ;
382376 expect ( headers . authorization ) . toBe ( 'Bearer api' ) ;
383- expect ( headers [ 'x-kilo-sandbox-id' ] ) . toBe ( 'sbx' ) ;
377+ expect ( headers [ 'x-kilo-sandbox-id' ] ) . toBeUndefined ( ) ;
384378 expect ( calls [ 0 ] . init . method ) . toBe ( 'POST' ) ;
385379 expect ( calls [ 0 ] . init . body ) . toBe ( JSON . stringify ( { conversationId : 'C' , emoji : '\u{1F44D}' } ) ) ;
386380 } ) ;
@@ -391,7 +385,6 @@ describe('POST /_kilo/kilo-chat/messages/:id/reactions', () => {
391385 new Response ( JSON . stringify ( { id : 'RXULIDXXX' } ) , { status : 200 } ) ) as typeof fetch ;
392386 registerKiloChatReactionPostRoute ( app , {
393387 expectedToken : 'gw' ,
394- sandboxId : 's' ,
395388 apiToken : 'a' ,
396389 baseUrl : 'http://svc' ,
397390 fetchImpl,
@@ -410,7 +403,6 @@ describe('POST /_kilo/kilo-chat/messages/:id/reactions', () => {
410403 const app = new Hono ( ) ;
411404 registerKiloChatReactionPostRoute ( app , {
412405 expectedToken : 'gw' ,
413- sandboxId : 's' ,
414406 apiToken : 'a' ,
415407 baseUrl : 'http://svc' ,
416408 fetchImpl : ( async ( ) => new Response ( ) ) as typeof fetch ,
@@ -429,7 +421,6 @@ describe('POST /_kilo/kilo-chat/messages/:id/reactions', () => {
429421 const app = new Hono ( ) ;
430422 registerKiloChatReactionPostRoute ( app , {
431423 expectedToken : 'gw' ,
432- sandboxId : 's' ,
433424 apiToken : 'a' ,
434425 baseUrl : 'http://svc' ,
435426 fetchImpl : ( async ( ) => new Response ( ) ) as typeof fetch ,
@@ -456,7 +447,6 @@ describe('DELETE /_kilo/kilo-chat/messages/:id/reactions', () => {
456447
457448 registerKiloChatReactionDeleteRoute ( app , {
458449 expectedToken : 'gw' ,
459- sandboxId : 'sbx' ,
460450 apiToken : 'api' ,
461451 baseUrl : 'http://svc' ,
462452 fetchImpl,
@@ -474,14 +464,13 @@ describe('DELETE /_kilo/kilo-chat/messages/:id/reactions', () => {
474464 expect ( calls [ 0 ] . url ) . toBe ( 'http://svc/v1/messages/MID/reactions' ) ;
475465 const headers = calls [ 0 ] . init . headers as Record < string , string > ;
476466 expect ( headers . authorization ) . toBe ( 'Bearer api' ) ;
477- expect ( headers [ 'x-kilo-sandbox-id' ] ) . toBe ( 'sbx' ) ;
467+ expect ( headers [ 'x-kilo-sandbox-id' ] ) . toBeUndefined ( ) ;
478468 } ) ;
479469
480470 it ( '401 on missing bearer' , async ( ) => {
481471 const app = new Hono ( ) ;
482472 registerKiloChatReactionDeleteRoute ( app , {
483473 expectedToken : 'gw' ,
484- sandboxId : 's' ,
485474 apiToken : 'a' ,
486475 baseUrl : 'http://svc' ,
487476 fetchImpl : ( async ( ) => new Response ( ) ) as typeof fetch ,
@@ -498,7 +487,6 @@ describe('body size limits', () => {
498487 const app = new Hono ( ) ;
499488 register ( app , {
500489 expectedToken : TOKEN ,
501- sandboxId : SANDBOX_ID ,
502490 apiToken : 'api_token' ,
503491 baseUrl : 'https://chat.example.test' ,
504492 fetchImpl,
0 commit comments