Support Content-Length and Last-Modified for webview local resources#125994
Merged
Conversation
Vtec234
commented
Jun 11, 2021
| /** | ||
| * Map of requested paths to responses. | ||
| * @typedef {{ type: 'response', body: any, mime: string, etag: string | undefined, } | { type: 'not-modified', mime: string } | undefined} ResourceResponse | ||
| * @typedef {{ type: 'response', body: Uint8Array, mime: string, etag: string | undefined, mtime: number | undefined } | |
Contributor
Author
There was a problem hiding this comment.
Note the stronger type on body: Uint8Array. AFAICT that's the only type which is ever passed through in a response and rely on it being so to call Uint8Array.byteLength.
Vtec234
commented
Jun 11, 2021
| } | ||
|
|
||
| /** @type {Record<String, string>} */ | ||
| /** @type {Record<string, string>} */ |
Vtec234
commented
Jun 11, 2021
| token: CancellationToken, | ||
| ): Promise<WebviewResourceResponse.StreamResponse> { | ||
| logService.debug(`loadLocalResource - being. requestUri=${requestUri}`); | ||
| logService.debug(`loadLocalResource - begin. requestUri=${requestUri}`); |
Collaborator
|
Thanks! Will be in the next VS Code insiders build and is scheduled for 1.58 |
Contributor
Author
|
Thanks! Is the macOS test failure not a concern? |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #125992
To test (steps from @mjbvz):
img.pngGETrequest