-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(fetch): properly release fetch during long-lived stream handling #13967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 30 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
ed91aaf
fix(fetch): ensure proper cancellation of child streams when parent s…
Lei-k f878695
style(fetch): fix formatting
Lei-k d0282f4
Merge branch 'develop' into fix/fetch-not-release
Lei-k 2c6d34e
fix: resolve multiple ESLint issues
Lei-k 4382ce0
Merge branch 'develop' into fix/fetch-not-release
Lei-k c7c943f
Merge branch 'develop' into fix/fetch-not-release
Lei-k 643a342
Merge branch 'develop' into fix/fetch-not-release
Lei-k f3aaa5d
Immediate stream cancellation after timeout in `_tryGetResponseText`
Lei-k 7f92ea3
Merge branch 'fix/fetch-not-release' of https://github.com/Lei-k/sent…
Lei-k 9b83669
fix conflicts
Lei-k 1d29564
Merge branch 'develop' into fix/fetch-not-release
Lei-k 80aa60d
Merge branch 'develop' into fix/fetch-not-release
Lei-k 0cf8645
Merge branch 'develop' into fix/fetch-not-release
Lei-k 6d66814
fix file formatting
Lei-k 0d10106
Update test cases to handle new logic in fetchUtils
Lei-k 536cc02
Merge branch 'develop' into fix/fetch-not-release
Lei-k 78ac956
feat: define whatwg's stream types
Lei-k 7fd0ffe
fix type error for tests
Lei-k 78b3ed3
Merge branch 'develop' into fix/fetch-not-release
Lei-k 8c99aee
Merge branch 'develop' into fix/fetch-not-release
Lei-k 5ec50f6
Merge branch 'develop' into fix/fetch-not-release
Lei-k 3923ecb
Merge branch 'getsentry:develop' into fix/fetch-not-release
Lei-k f13e8c2
Merge branch 'develop' into fix/fetch-not-release
Lei-k 4be816e
Merge branch 'develop' into fix/fetch-not-release
Lei-k 207ee69
Merge branch 'develop' into fix/fetch-not-release
Lei-k 94c0e2e
Merge branch 'develop' into fix/fetch-not-release
Lei-k 3ba1c20
Merge branch 'develop' into fix/fetch-not-release
Lei-k 189848d
Merge branch 'develop' into fix/fetch-not-release
Lei-k 8139565
Merge branch 'develop' into fix/fetch-not-release
Lei-k 8780cda
Merge branch 'develop' into fix/fetch-not-release
Lei-k 9ce2d8e
ref: Resolve merge conflict between develop and fix/fetch-not-release
Lei-k 5c6ce1d
ref: fix typo
Lei-k 2ed739d
ref: prettify file format
Lei-k 02c2448
ref: fix file format
Lei-k b0b096a
Merge branch 'develop' into fix/fetch-not-release
Lei-k 8181799
Merge branch 'develop' into fix/fetch-not-release
Lei-k dc69ad3
Merge branch 'develop' into fix/fetch-not-release
Lei-k dd4505e
chore: resolve conflict from PR #14745
Lei-k e506037
Merge branch 'develop' into fix/fetch-not-release
Lei-k 423bd67
Merge branch 'develop' into fix/fetch-not-release
Lei-k 7f0c21b
Merge branch 'develop' into fix/fetch-not-release
Lei-k 78d4453
Merge branch 'develop' into fix/fetch-not-release
Lei-k 8137807
Merge branch 'develop' into fix/fetch-not-release
Lei-k 617fcc3
Merge branch 'develop' into fix/fetch-not-release
Lei-k 09a0fda
Merge branch 'develop' into fix/fetch-not-release
Lei-k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// These are vendored types for the standard web fetch API types because typescript needs the DOM types to be able to understand the `Request`, `Headers`, ... types and not everybody has those. | ||
|
||
import type { WebReadableStream } from './stream'; | ||
|
||
export interface WebFetchHeaders { | ||
append(name: string, value: string): void; | ||
delete(name: string): void; | ||
get(name: string): string | null; | ||
has(name: string): boolean; | ||
set(name: string, value: string): void; | ||
forEach(callbackfn: (value: string, key: string, parent: WebFetchHeaders) => void): void; | ||
} | ||
|
||
export interface WebFetchRequest { | ||
readonly headers: WebFetchHeaders; | ||
readonly method: string; | ||
readonly url: string; | ||
clone(): WebFetchRequest; | ||
} | ||
|
||
export interface WebFetchResponse { | ||
readonly ok: boolean; | ||
readonly status: number; | ||
readonly statusText: string; | ||
readonly headers: WebFetchHeaders; | ||
readonly url: string; | ||
readonly redirected: boolean; | ||
readonly body: WebReadableStream | null; | ||
|
||
clone(): WebFetchResponse; | ||
|
||
// Methods to consume the response body | ||
json(): Promise<any>; // Parses response as JSON | ||
text(): Promise<string>; // Reads response body as text | ||
arrayBuffer(): Promise<ArrayBuffer>; // Reads response body as ArrayBuffer | ||
blob(): Promise<object>; // Reads response body as Blob | ||
formData(): Promise<object>; // Reads response body as FormData | ||
} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type { WebReadableStream, WebReadableStreamDefaultReader, WebReadableStreamReadResult } from './stream'; | ||
|
||
export type { WebFetchHeaders, WebFetchRequest, WebFetchResponse } from './fetch'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export interface WebReadableStream<R = any> { | ||
locked: boolean; // Indicates if the stream is currently locked | ||
|
||
cancel(reason?: any): Promise<void>; // Cancels the stream with an optional reason | ||
getReader(): WebReadableStreamDefaultReader<R>; // Returns a reader for the stream | ||
} | ||
|
||
export interface WebReadableStreamDefaultReader<R = any> { | ||
closed: boolean; | ||
// Closes the stream and resolves the reader's lock | ||
cancel(reason?: any): Promise<void>; | ||
|
||
// Returns a promise with the next chunk in the stream | ||
read(): Promise<WebReadableStreamReadResult<R>>; | ||
|
||
// Releases the reader's lock on the stream | ||
releaseLock(): void; | ||
} | ||
|
||
export interface WebReadableStreamReadResult<R = any> { | ||
done: boolean; // True if the reader is done with the stream | ||
value?: R; // The data chunk read from the stream (if not done) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we need to define the DOM types, maybe according to the WHATWG spec?