Worker to worker request with third party library
Is it possible for one worker to make requests to another worker connected as a service binding using something other than the native
fetch
?4 Replies
Iām not too sure what you mean by that - Service Bindings only expose a fetch method.
Yeah. I was just curious if you could use another library like wretch (https://github.com/elbywan/wretch) to make that request from one worker to another. The reason this even came to mind for me is because in a scenario where worker A calls B, and say B could respond with different HTTP status codes, then A will have to check for each one of them in an if statement and decide how to handle each. Other libraries provide better ergonomics for doing this type of operation (wretch for example).
you can probably do it with their polyfills option
might not work exactly like that since I haven't tested it
Thanks for pointing that out, I'll take a look š