Skip to content

Replace typed-rest-client with global fetch - #1339

Open
Trivikram Kamat (trivikr) wants to merge 1 commit into
microsoft:mainfrom
trivikr:remove-typed-rest-client
Open

Trivikram Kamat (trivikr) wants to merge 1 commit into
microsoft:mainfrom
trivikr:remove-typed-rest-client

Conversation

@trivikr

Copy link
Copy Markdown

typed-rest-client was only used by PublicGalleryAPI (src/publicgalleryapi.ts), so this swaps it for the built-in fetch that comes with Node 22, and removes it from dependencies.

  • post() now calls fetch and still sends the User-Agent: vsce header that HttpClient('vsce') used to set.
  • New status check: a non-2xx response throws with the gallery's own error message when the body has one, and otherwise with Gallery request failed: <status> <statusText>. Before, these surfaced as an unclear JSON parse error. The existing errorCode check is still there.

typed-rest-client was only used by PublicGalleryAPI, so it can go now
that Node 22 has a built-in fetch.

Keep the 'vsce' User-Agent that HttpClient('vsce') used to send, and
add a status check: a non-2xx response now throws with the gallery's
error message, or the HTTP status if there isn't one. Before, it
surfaced as an unclear JSON parse error.
@trivikr

Copy link
Copy Markdown
Author

cc Benjamin Christopher Simmonds (@benibenj) Can you please review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant