Skip to content

url.format(undefined) fails in io.js, where it works in Node.js (TypeError: Cannot read property 'auth' of undefined) #1033

Closed
@hairyhenderson

Description

@hairyhenderson

In node.js (tested on v0.12.0 and v0.10.33):

$ node -e "console.log('%j',require('url').format(undefined))" 
""

In io.js (tested on v1.4.2 and v1.0.4):

$ node -e "console.log('%j',require('url').format(undefined))"
url.js:361
  var auth = this.auth || '';
                 ^
TypeError: Cannot read property 'auth' of undefined
    at Url.format (url.js:361:18)
    at Object.urlFormat [as format] (url.js:356:58)
    at [eval]:1:33
    at Object.exports.runInThisContext (vm.js:54:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:444:26)
    at evalScript (node.js:477:25)
    at startup (node.js:73:7)
    at node.js:863:3

I've dug into this a little bit, and I'm not really sure why it worked in node.js - probably something to do with different V8 versions? Even though this seems to be an edge case, this is a behaviour difference, and breaks a unit test in a project of mine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.urlIssues and PRs related to the legacy built-in url module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions