Skip to content
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

Switch from XHR to Fetch API #4991

Merged
merged 1 commit into from
Oct 11, 2023
Merged

Switch from XHR to Fetch API #4991

merged 1 commit into from
Oct 11, 2023

Conversation

bduffany
Copy link
Member

This is in preparation for switching the timing profile to use a streaming HTTP request for loading and parsing the JSON profile. XHR supports streaming but it's very ugly.

  • Switch from XHR to Fetch
  • Remove storedEncoding as a method param (since it's pretty niche), and instead pass the stored-encoding header directly via the standard RequestInit object
  • Improve type safety of fetch() method - instead of Promise<any>, returns Promise<ArrayBuffer> when setting request type to arraybuffer, Promise<string> when setting request type to "text", etc.

Related issues: N/A

@bduffany
Copy link
Member Author

bduffany commented Oct 10, 2023

(Will wait to submit this until after tomorrow's release since it's touching low-level RPC code)

@siggisim
Copy link
Member

Maybe this will make it easier for us to one day support streaming protolet RPCs 🤞

@bduffany bduffany merged commit 9aaf060 into master Oct 11, 2023
10 of 11 checks passed
@bduffany bduffany deleted the rpc-service-fetch-api branch October 11, 2023 20:00
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.

2 participants