Skip to content

Conversation

@steebchen
Copy link
Contributor

Allows passing a custom fetch function via config for HTTP requests.

Allows passing a custom fetch function via config for HTTP requests.
@good-lly
Copy link
Owner

Thank you for this PR! Could you please elaborate on the motivation? What issue does this solve, and in which environment?

@steebchen
Copy link
Contributor Author

It allows for a custom fetch implementation, which might bring various use cases of a custom fetch function, but my specific use case was for https://github.com/cloudflare/workerd internal functions which provides its own fetch function for a specific network instead of the global fetch, so this PR allows me to do that.

@steebchen
Copy link
Contributor Author

steebchen commented Oct 31, 2025

The only thing I'm not sure about is whether the default = globalThis.fetch is correct, maybe = fetch might be a better default

@good-lly
Copy link
Owner

ok, I can merge it - but can you add some simple e2e test for that feature?

@steebchen
Copy link
Contributor Author

15557c3 (#45)

@steebchen
Copy link
Contributor Author

also it seems globalThis is the way to go:

"globalThis" is a standardized, cross-platform, and universal way to access the global object across all JavaScript environments (browsers, Node.js, web workers, etc.). It was introduced in ECMAScript 2020 to unify access to the global object.

@good-lly good-lly merged commit 781c254 into good-lly:dev Nov 2, 2025
1 check passed
@steebchen
Copy link
Contributor Author

thanks for merging!

@good-lly
Copy link
Owner

good-lly commented Nov 5, 2025

thanks for merging!

thanks for your contribution!!!! Going to doublecheck on weekend and make new release!

@steebchen steebchen deleted the feat/fetch branch November 5, 2025 08:52
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