-
Notifications
You must be signed in to change notification settings - Fork 306
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
dd-trace plugin-http doesn't support WHATWG URL objects #829
Comments
Had a chance to take a quick look at this on the plane. I was able to reproduce this, thank you for the snippet @daniel-edwards-iress ! I believe what's happening is that this test case is being hit: Where, basically, there's an attempt to copy the
Which uses a quick fix here could be to use a let options
if(typeof inputURL === 'string') {
options = url.parse(inputURL)
} else {
options = {}
for(const key in inputUrl) {
options[key] = inputUrl[key]
}
} I haven't totally thought through if there's any other implications that would occur from this though, and if this change is made it may also make sense to clean up the other uses of Object.assign in this helper function a bit further down. Thoughts? |
Only thought would be to filter out functions from the copied keys. let options
if(typeof inputURL === 'string') {
options = url.parse(inputURL)
} else {
options = {}
for(const key in inputUrl) {
if (typeof options[key] !== 'function')
options[key] = inputUrl[key]
}
} as for making the change from Object.assign more generally I think it might be good to use a replacement to wrap it but can be extended with logic like if a predicate is provided only those that pass get assigned |
Describe the bug
When making a request using a WHATWG URL object (node URL) dd-trace clears the request URL.
The latest Got converts urls before making the request.
Simple example
Environment
The text was updated successfully, but these errors were encountered: