Skip to content

Commit

Permalink
[docs] Document usage of username/password in Y.io config. Fix #1572
Browse files Browse the repository at this point in the history
  • Loading branch information
customcommander authored and okuryu committed Mar 16, 2014
1 parent 5d3668d commit d2b50b4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/io/docs/index.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ YUI().use("io-base", function(Y) {
<td>headers (object)</td>
<td>Specific HTTP headers and values to be sent with the transaction (e.g., <code>{ 'Content-Type': 'application/xml; charset=utf-8' } </code>).</td>
</tr>
<tr>
<td>username (string).</td>
<td>Username for a basic HTTP authentication (e.g. .htaccess).</td>
</tr>
<tr>
<td>password (string).</td>
<td>Password for a basic HTTP authentication (e.g. .htaccess).</td>
</tr>
<tr>
<td>on (object)</td>
<td>This object can be used to register transaction event handlers for the set of supported io events, listed below. These events fire in addition to the global io events. All events handlers are optional.
Expand Down Expand Up @@ -250,6 +258,23 @@ var cfg = {

```

<p>Example of authentication with `Y.io`.</p>

```
Y.io('priv/data.json', {
username: 'foo',
password: 'bar',
on: {
success: function () {
//got the data, carry on
},
failure: function () {
//err, 401
}
}
});
```

<h3>The Response Object</h3>
<p>
When a transaction, using the XHR object as a transport, is complete, the response data are passed as an object to the event handler.
Expand Down
6 changes: 6 additions & 0 deletions src/io/js/io-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,12 @@ IO.prototype = {
* object keys are the header names and the values are the header
* values.</dd>
*
* <dt>username</dt>
* <dd>Username to use in a HTTP authentication.</dd>
*
* <dt>password</dt>
* <dd>Password to use in a HTTP authentication.</dd>
*
* <dt>timeout</dt>
* <dd>Millisecond threshold for the transaction before being
* automatically aborted.</dd>
Expand Down

0 comments on commit d2b50b4

Please sign in to comment.