Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: added url.resolve() method's behaviour
  • Loading branch information
minervapanda committed Oct 7, 2016
commit c0e17850d874b12050ef18bf110731964d2fe3dc
13 changes: 13 additions & 0 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@ url.resolve('http://example.com/', '/one') // 'http://example.com/one'
url.resolve('http://example.com/one', '/two') // 'http://example.com/two'
```

Note that `url.resolve()` method depends on the protocol given in the `from` parameter.
Some protocols like `https`, `file`, `ftp`, `wss` and `gopher` have special cases.

For example:

```js
url.resolve('https://foo.tld', 'bar') // 'https://foo.tld/bar'
url.resolve('wss://foo.tld', 'bar') // 'wss://bar'
url.resolve('ftps://foo.tld', 'bar') // 'ftps://bar'
```

Although, the uniform behaviour of the method is achieved when the URL ends with a slash.

## Escaped Characters

URLs are only permitted to contain a certain range of characters. Spaces (`' '`)
Expand Down