Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/update-runtime-c6145…
Browse files Browse the repository at this point in the history
…42772
  • Loading branch information
mergify[bot] authored Jan 15, 2025
2 parents edf81f4 + 9b0ab06 commit 17f9d36
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/modules/sse/SseModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,17 @@ export default class SseModule extends ConnectorRuntimeModule<SseModuleConfigura

const baseOptions = { connect: { rejectUnauthorized: false } };
const proxy = baseUrl.startsWith("https://") ? (process.env.https_proxy ?? process.env.HTTPS_PROXY) : (process.env.http_proxy ?? process.env.HTTP_PROXY);
const token = await this.runtime.getBackboneAuthenticationToken();

const eventSource = new EventSource(sseUrl, {
fetch: (url, options) =>
fetch(url, {
fetch: async (url, options) => {
const token = await this.runtime.getBackboneAuthenticationToken();

return await fetch(url, {
...options,
dispatcher: proxy ? new ProxyAgent({ ...baseOptions, uri: proxy }) : new Agent(baseOptions),
headers: { ...options?.headers, authorization: `Bearer ${token}` }
})
});
}
});

this.eventSource = eventSource;
Expand Down

0 comments on commit 17f9d36

Please sign in to comment.