Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Document port number escaping in URL for $resource #1672

Closed
wants to merge 2 commits into from
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
8 changes: 5 additions & 3 deletions src/ngResource/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
* the need to interact with the low level {@link ng.$http $http} service.
*
* @param {string} url A parameterized URL template with parameters prefixed by `:` as in
* `/user/:username`.
* `/user/:username`. If you are using URL with a port number (e.g. `http://example.com:8080/api`),
* you'll need to escape colon character before the port number, like this:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight nitpicks: "a URL" instead of "URL" and "the colon" instead of "colon"

Rest looks good, thanks for opening this PR!

* `$resource('http://example.com\\:8080/api')`.
*
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
* `actions` methods. If any of the parameter value is a function, it will be executed every time
* when a param value needs to be obtained for a request (unless the param was overriden).
* when a param value needs to be obtained for a request (unless the param was overriden).
*
* Each key value in the parameter object is first bound to url template if present and then any
* excess keys are appended to the url search query after the `?`.
Expand Down Expand Up @@ -229,7 +231,7 @@ angular.module('ngResource', ['ng']).
};

/**
* We need our custom mehtod because encodeURIComponent is too aggressive and doesn't follow
* We need our custom method because encodeURIComponent is too aggressive and doesn't follow
* http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
* segments:
* segment = *pchar
Expand Down