Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Add custom fetch for Electron #218

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jdgjsag67251
Copy link

The default fetch method is restricted by the browser context in which the app runs. This means that all requests are subjected to CORS and other web security mechanisms. This can sometimes be a pain, so with this pull-request this library now uses node-fetch in Electron contexts.

The default fetch method is restricted by the browser context in which
the app runs. This means that all requests are subjected to CORS and
other web security mechanisms. This can sometimes be a pain, so this
library now uses node-fetch in Electron contexts.
};

class FetchHelper {
private static _responses = new Map<string, Response>();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is important that _getResponse (getBuffer, getText, getJson, getBlob) gets called; otherwise there could be a memory leak... The client side library will always do this, but this function is also exported to be used separately...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1718da7 should remediate somewhat

@thomasvidas
Copy link
Contributor

Wow! This looks excellent. When I get some time, I'll test, approve, and merge it into the v1 branch. Thanks for your contribution 😄

- Added 'dispose' method(s)
- Added FinalizationRegistry
@AmirHmZz
Copy link

Any updates on this ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants