Skip to content

Commit

Permalink
Merge pull request YahooArchive#201 from drewfish/yui351-fixups4
Browse files Browse the repository at this point in the history
more regressions from Y.io() @3.5.1
[compat] getStatusMessage() returns the http status numeric code.
http status text/msg no longer available, as the underlying Y.io
api has changed.
[deprecation] rest.common.js is deprecated.
  • Loading branch information
Isao Yagi committed Jun 11, 2012
2 parents 24510c9 + 0bafc47 commit e8d80cb
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions source/lib/app/autoload/rest.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ YUI.add('mojito-rest-lib', function(Y, NAME) {

ResponseObject.prototype = {
getStatusCode: function() {
return this._resp.status;
return this._resp.statusCode;
},
getStatusMessage: function() {
return this._resp.statusText;
return this._resp.status;
},
getHeader: function() {
return this._resp.getResponseHeader.apply(this._resp, arguments);
},
getHeaders: function() {
return this._resp.getAllResponseHeaders();
// caller expects object
return Y.clone(this._resp.headers, true);
},
getBody: function() {
return this._resp.responseText;
Expand All @@ -60,13 +61,19 @@ YUI.add('mojito-rest-lib', function(Y, NAME) {
// themselves to headers!
var ioConfig = {
method: method,
data: '',
on: {}
};
if (params) {
if (Y.Lang.isObject(params)) {
ioConfig.data = Y.QueryString.stringify(params);
} else if (Y.Lang.isString(params)) {
params = Y.QueryString.stringify(params);
}
if ('GET' === method) {
if (-1 === url.indexOf('?')) {
url += '?' + params;
} else {
url += '&' + params;
}
} else if ('POST' === method) {
ioConfig.data = params;
}
}
Expand Down

0 comments on commit e8d80cb

Please sign in to comment.