@@ -302,7 +302,6 @@ export class Sandbox extends BaseSandbox {
302302 try {
303303 const headers : Record < string , string > = {
304304 'Content-Type' : 'application/json' ,
305- ...this . connectionConfig . headers ,
306305 }
307306
308307 if ( this . trafficAccessToken ) {
@@ -343,7 +342,6 @@ export class Sandbox extends BaseSandbox {
343342 const id = typeof context === 'string' ? context : context . id
344343 const headers : Record < string , string > = {
345344 'Content-Type' : 'application/json' ,
346- ...this . connectionConfig . headers ,
347345 }
348346
349347 if ( this . trafficAccessToken ) {
@@ -375,15 +373,17 @@ export class Sandbox extends BaseSandbox {
375373 */
376374 async listCodeContexts ( ) : Promise < Context [ ] > {
377375 try {
376+ const headers : Record < string , string > = {
377+ 'Content-Type' : 'application/json' ,
378+ }
379+
380+ if ( this . trafficAccessToken ) {
381+ headers [ 'E2B-Traffic-Access-Token' ] = this . trafficAccessToken
382+ }
383+
378384 const res = await fetch ( `${ this . jupyterUrl } /contexts` , {
379385 method : 'GET' ,
380- headers : {
381- 'Content-Type' : 'application/json' ,
382- ...this . connectionConfig . headers ,
383- ...( this . trafficAccessToken
384- ? { 'E2B-Traffic-Access-Token' : this . trafficAccessToken }
385- : { } ) ,
386- } ,
386+ headers,
387387 keepalive : true ,
388388 signal : this . connectionConfig . getSignal (
389389 this . connectionConfig . requestTimeoutMs
@@ -413,7 +413,6 @@ export class Sandbox extends BaseSandbox {
413413 const id = typeof context === 'string' ? context : context . id
414414 const headers : Record < string , string > = {
415415 'Content-Type' : 'application/json' ,
416- ...this . connectionConfig . headers ,
417416 }
418417
419418 if ( this . trafficAccessToken ) {
0 commit comments