-
Notifications
You must be signed in to change notification settings - Fork 305
Closed
Description
Using Node@9.9 on OSX.
Problem
> const url = require('url')
> url.format({hostname: 'dougbeck.me', pathname: 'womp.html'})
'dougbeck.mewomp.html'
> 😭
Am I crazy for thinking this is broken behavior?
Granted, this seems to be terrible in every other language:
Python
>>> urllib.parse.urlunparse(('', 'dougbeck.me', 'womp.html', '', '', ''))
'//dougbeck.me/womp.html'
Requiring a 6-item tuple is gross.
Ruby
> URI::HTTP.build(host: 'dougbeck.me', path: 'womp.html').to_s
ERROR expected absolute path
Java
> new URL("dougbeck.me").toString()
ERROR: no protocol
Node's behavior is worse than all of ☝️because it does not throw an error and returns a result that defies all intuition. 😖
addaleax
Metadata
Metadata
Assignees
Labels
No labels