-
Notifications
You must be signed in to change notification settings - Fork 24
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
Request library deprecated #12
Comments
this looks promising: https://github.com/blocktrail/superagent-http-signature However it's forked from an hold version of http-signature so it will almost certainly need the patches we're currently applying to http-signature added to it |
I have played a bit with I've made draft version of Generating signatures is done but I still have problems with verification of the generated signature so I may have made some mistakes as this is my first time dealing with But overall I do think |
@gregid this looks great! Can you start a pull request and we'll work out the kinks together? |
Will do - I didn't want to impose this without your interest. |
@wmurphyrd I'd perhaps be inclined to look towards Node 18's fetch support, which is undici under the hood (requires at least node 16) Then you'd just need the ability to take a Request / Response object and do http-signatures on it, potentially even allowing setting fetch on the |
@ThisIsMissEm oh now this is interesting. I'd glanced at node's fetch when it was announced, but didn't think it would work here because of the need to manipulate an existing Request object. I just looked again based on your prompting and realized that all these years using fetch in the browser, I'd never noticed it's possible to construct a Request first and then pass it to fetch. I also just created an interface mock for http-signature to use in the unit tests, so I'm pretty certain I could coerce http-signature to work with a Request |
@ThisIsMissEm well, converting the code to
So, no idea if it actually works, and refactoring request mocking for the test suites would be a massive chore. Looks like native fetch is out at least for now |
Ah, yeah, we've seen similar issue with the question of "how to mock fetch in node.js 18" in the @inrupt Solid SDKs, the approach we're taking is to shim it, so we'll have a module that either directs to It's still early days for us, but we're going to have to rewrite all our unit tests to this new setup away from module mocking cross-fetch. Once we've something working, I kinda want to take it to WinterCG to propose a standardised way to mock fetch. |
Interestingly, undici, which powers node's native fetch, does have built-in mocking https://undici.nodejs.org/#/docs/api/MockAgent I can't see any way to use this with fetch, but I think we could just use undici directly instead of the fetch wrapper oh and here's a useful reference from another project making the same conversion from nock to MockAgent: vansergen/poloniex-node-api#91 |
Oh? Interesting! I thought it worked for that. Either way, we'll hopefully have a new module out soon that'll help |
Find a new library for sending http requests
node-fetch
is out, with a proposed fix sitting idle for 3 years Add onrequest option node-fetch/node-fetch#480The text was updated successfully, but these errors were encountered: