|
2072 | 2072 | var options = request.toOptions(); |
2073 | 2073 |
|
2074 | 2074 | return [ |
2075 | | - options.type.toUpperCase(), |
| 2075 | + options.method.toUpperCase(), |
2076 | 2076 | this.encodeURI(options.url), |
2077 | 2077 | rfc3986Encode(this.encodeParameters(request, oauthParams)) |
2078 | 2078 | ].join('&'); |
|
2428 | 2428 |
|
2429 | 2429 | RAML.Client.Request = { |
2430 | 2430 | create: function(url, method) { |
2431 | | - return new RequestDsl({ url: url, type: method }); |
| 2431 | + return new RequestDsl({ url: url, method: method }); |
2432 | 2432 | } |
2433 | 2433 | }; |
2434 | 2434 | })(); |
@@ -3590,8 +3590,8 @@ RAML.Inspector = (function() { |
3590 | 3590 | var xhr = new root.XMLHttpRequest(); |
3591 | 3591 | var headers = options.headers || {}; |
3592 | 3592 |
|
3593 | | - // Open the request to the uri and method. |
3594 | | - xhr.open(options.method, options.uri); |
| 3593 | + // Open the request to the url and method. |
| 3594 | + xhr.open(options.method, options.url); |
3595 | 3595 |
|
3596 | 3596 | // When the request has loaded, attempt to automatically parse the body. |
3597 | 3597 | xhr.onload = function () { |
@@ -3628,20 +3628,20 @@ RAML.Inspector = (function() { |
3628 | 3628 | * @param {Function} done |
3629 | 3629 | */ |
3630 | 3630 | ClientOAuth2.prototype.request = function (options, done) { |
3631 | | - var lib = http; |
3632 | | - var reqOpts = url.parse(options.uri); |
| 3631 | + var lib = http; |
| 3632 | + var reqOptions = url.parse(options.url); |
3633 | 3633 |
|
3634 | 3634 | // If the protocol is over https, switch request library. |
3635 | | - if (reqOpts.protocol === 'https:') { |
| 3635 | + if (reqOptions.protocol === 'https:') { |
3636 | 3636 | lib = https; |
3637 | 3637 | } |
3638 | 3638 |
|
3639 | 3639 | // Alias request options. |
3640 | | - reqOpts.method = options.method; |
3641 | | - reqOpts.headers = options.headers; |
| 3640 | + reqOptions.method = options.method; |
| 3641 | + reqOptions.headers = options.headers; |
3642 | 3642 |
|
3643 | 3643 | // Send the http request and listen for the response to finish. |
3644 | | - var req = lib.request(reqOpts, function (res) { |
| 3644 | + var req = lib.request(reqOptions, function (res) { |
3645 | 3645 | var data = ''; |
3646 | 3646 |
|
3647 | 3647 | // Callback to `done` if a response error occurs. |
@@ -3701,44 +3701,44 @@ RAML.Inspector = (function() { |
3701 | 3701 | /** |
3702 | 3702 | * Sign a standardised request object with user authentication information. |
3703 | 3703 | * |
3704 | | - * @param {Object} opts |
| 3704 | + * @param {Object} options |
3705 | 3705 | * @return {Object} |
3706 | 3706 | */ |
3707 | | - ClientOAuth2Token.prototype.sign = function (opts) { |
| 3707 | + ClientOAuth2Token.prototype.sign = function (options) { |
3708 | 3708 | if (!this.accessToken) { |
3709 | 3709 | throw new Error('Unable to sign without access token'); |
3710 | 3710 | } |
3711 | 3711 |
|
3712 | | - opts.headers = opts.headers || {}; |
| 3712 | + options.headers = options.headers || {}; |
3713 | 3713 |
|
3714 | 3714 | if (this.tokenType === 'bearer') { |
3715 | | - opts.headers.Authorization = 'Bearer ' + this.accessToken; |
| 3715 | + options.headers.Authorization = 'Bearer ' + this.accessToken; |
3716 | 3716 | } else { |
3717 | | - var parts = opts.uri.split('#'); |
| 3717 | + var parts = options.url.split('#'); |
3718 | 3718 | var token = 'access_token=' + this.accessToken; |
3719 | | - var uri = parts[0].replace(/[?&]access_token=[^&#]/, ''); |
| 3719 | + var url = parts[0].replace(/[?&]access_token=[^&#]/, ''); |
3720 | 3720 | var fragment = parts[1] ? '#' + parts[1] : ''; |
3721 | 3721 |
|
3722 | | - // Prepend the correct query string parameter to the uri. |
3723 | | - opts.uri = uri + (uri.indexOf('?') > -1 ? '&' : '?') + token + fragment; |
| 3722 | + // Prepend the correct query string parameter to the url. |
| 3723 | + options.url = url + (url.indexOf('?') > -1 ? '&' : '?') + token + fragment; |
3724 | 3724 |
|
3725 | | - // Attempt to avoid storing the uri in proxies, since the access token |
| 3725 | + // Attempt to avoid storing the url in proxies, since the access token |
3726 | 3726 | // is exposed in the query parameters. |
3727 | | - opts.headers.Pragma = 'no-store'; |
3728 | | - opts.headers['Cache-Control'] = 'no-store'; |
| 3727 | + options.headers.Pragma = 'no-store'; |
| 3728 | + options.headers['Cache-Control'] = 'no-store'; |
3729 | 3729 | } |
3730 | 3730 |
|
3731 | | - return opts; |
| 3731 | + return options; |
3732 | 3732 | }; |
3733 | 3733 |
|
3734 | 3734 | /** |
3735 | 3735 | * Make a HTTP request as the user. |
3736 | 3736 | * |
3737 | | - * @param {Object} opts |
| 3737 | + * @param {Object} options |
3738 | 3738 | * @param {Function} done |
3739 | 3739 | */ |
3740 | | - ClientOAuth2Token.prototype.request = function (opts, done) { |
3741 | | - return this.client.client.request(this.sign(opts), done); |
| 3740 | + ClientOAuth2Token.prototype.request = function (options, done) { |
| 3741 | + return this.client.client.request(this.sign(options), done); |
3742 | 3742 | }; |
3743 | 3743 |
|
3744 | 3744 | /** |
|
0 commit comments