Closed martonlederer closed 1 year ago
Status of this PR:
Headers
class used by fetch
is undefined and my solution to polyfill it does not work (polyfill code here)Any help is appreciated!
@rosmcmahon if you have a little bit of time to look at this, that would help massively as well
One possible solution could be to utilize the same technique that the crypto-driver uses in arweave-js, but I feel like this would be an overkill (?)
https://github.com/ArweaveTeam/arweave-js/blob/master/src/common/lib/api.ts#L46-L59
public async get<T = any>(
endpoint: string,
config?: AxiosRequestConfig
): Promise<AxiosResponse<T>> {
try {
return await this.request().get<T>(endpoint, config);
} catch (error: any) {
if (error.response && error.response.status) {
return error.response;
}
throw error;
}
}
ah. i didn't realise the purpose of the Axios error handling in this function before. it's making it like Fetch API:
so there has been some work done in preparing arweave-js for conversion to fetch already...
Yeah exactly, that's what I realized too. Altho this could have been done more easily, with validateStatus.
i'm looking at raising the minimum node.js version to 16 and using the new built-in Fetch API
i'm looking at raising the minimum node.js version to 16 and using the new built-in Fetch API
Would be the easiest solution. Do you think it would cause mayor incompatibilities? LTS is 18.12.1
right now, so i think it would be fine.
hey @martonlederer can i get push access to your repo?
@rosmcmahon you should be invited now
no Windows laptop handy. troubleshooting through github actions 😃
all tests passing...
thoughts about using nodejs Fetch API:
i'm not gonna publish this straight away. maybe another set of eyes first, and then update the minor version.
can you be the extra set of eyes @hlolli ?
I'll also do some tests in ArConnect. Thanks @rosmcmahon!
yeah, great work @martonlederer !! thanks for taking the time on this important PR! 😃
This pull request refactors the
arweave-js
codebase to use thefetch
API instead of theaxios
module. This fixes the incompatibility with service workers and chrome extensions based on the Manifest v3 standard.Closes #184