Skip to content

Commit

Permalink
add keep alive option to fetch standard transport (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky authored Feb 10, 2023
1 parent 0de4a54 commit 171cd15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-pumpkins-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@segment/analytics-next': minor
---

Add keep-alive header to fetch for standard transport.
1 change: 1 addition & 0 deletions packages/browser/src/plugins/segmentio/fetch-dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type Dispatcher = (url: string, body: object) => Promise<unknown>
export default function (): { dispatch: Dispatcher } {
function dispatch(url: string, body: object): Promise<unknown> {
return fetch(url, {
keepalive: true,
headers: { 'Content-Type': 'text/plain' },
method: 'post',
body: JSON.stringify(body),
Expand Down

0 comments on commit 171cd15

Please sign in to comment.