Commit abb00cc9 authored by Christian Tellnes's avatar Christian Tellnes
Browse files

url: throw for invalid values to url.format

`'use strict'` changes the behavior for `Function.prototype.call` when
the context is `undefined`. In earlier versions of node the value
`undefined` would make `url.format` look for fields in the global scope.

The docs states that `url.format` takes a parsed URL object and returns
a formatted URL string. So with this change it will now throw for other
values.

The exception is if the input is a string. Then it will call `url.parse`
on the string and then format it. The reason for that is that you can
call `url.format` on strings to clean up potentially wonky urls.

Fixes: https://github.com/iojs/io.js/issues/1033
PR-URL: https://github.com/iojs/io.js/pull/1036


Reviewed-By: default avatarTrevor Norris <trev.norris@gmail.com>
Reviewed-By: default avatarBrian White <mscdex@mscdex.net>
Reviewed-By: default avatarJulian Duque <julianduquej@gmail.com>
parent 31142415
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment