-
Notifications
You must be signed in to change notification settings - Fork 299
fix: throw on invalid multiaddr to constructor #934
Conversation
- dont assume that invalid multiaddrs are valid hosts - if multiaddrOrHost starts with a /, assume its a multiaddr - throw if that multiaddr is invalid. Previously, we'd try and use invalid multiaddrs as the host, which would lead to requests like http:///dnsaddr/foobar.com:5001/api License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
Woah, CI is not happy at all with this... |
- explicitly handle all the cases we expect to be passed - convert each param into an object so we can merge them - presedence is right to left as with Object.assign License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
- ensure explicitly passed parameters are used; dont pass in the default values and assume the are being set correctly TODO: needs #935 to expose the protocol and api-path properties License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
@alanshaw ok so, their was a bug that showed we were missing some test cases from the To neatly check that the constructor params are updating the endpoint config that ends up being used, I need to additionally expose both the |
License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
Ready for review. I've updated it to make use of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for all the tests!
@olizilla looks like the browser tests are failing where the port is being detected from the browser URL - I guess karma is setup to run on port 9876. |
License: MIT Signed-off-by: Oli Evans <oli@tableflip.io>
…http-client into throw-on-invalid-multiaddr
@alanshaw I think I have everything apart from my commit messages correct now. I hope you can forgive that one. |
Previously, we'd try and use invalid multiaddrs as the host,
which would lead to requests like http:///dnsaddr/foobar.com:5001/api
see: ipfs/ipfs-webui#925
License: MIT
Signed-off-by: Oli Evans oli@tableflip.io