Permalink
Browse files

Fixed issues with statusText and config.data with Get requests

  • Loading branch information...
1 parent 5ded3d8 commit 4b03344978520a7e55dd70f461b21cf81f33aeac @davglass davglass committed Jun 11, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/io/js/io-nodejs.js
@@ -11,6 +11,8 @@
Y.IO.request = require('request');
}
+ var codes = require('http').STATUS_CODES;
+
Y.log('Loading NodeJS Request Transport', 'info', 'io');
/**
@@ -71,6 +73,7 @@
Y.log('Starting Request Transaction', 'info', 'io');
config.notify('start', transaction, config);
config.method = config.method || 'GET';
+ config.method = config.method.toUpperCase();
var rconf = {
method: config.method,
@@ -88,6 +91,10 @@
} else if (Y.Lang.isString(config.data)) {
rconf.body = config.data;
}
+ if (rconf.method === 'GET') {
+ rconf.uri += (rconf.uri.indexOf('?') > -1 ? '&' : '?') + rconf.body;
+ rconf.body = '';
+ }
}
if (config.headers) {
rconf.headers = config.headers;
@@ -112,6 +119,7 @@
transaction.c = {
status: data.statusCode,
statusCode: data.statusCode,
+ statusText: codes[data.statusCode],
headers: data.headers,
responseText: data.body,
responseXML: null,

0 comments on commit 4b03344

Please sign in to comment.