Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Syncing with keigai
Browse files Browse the repository at this point in the history
Fixing copy/paste error
  • Loading branch information
avoidwork committed Jun 9, 2014
1 parent 0002727 commit b473797
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 226 deletions.
47 changes: 26 additions & 21 deletions lib/abaaso.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license BSD-3 <https://raw.github.com/avoidwork/abaaso/master/LICENSE>
* @link http://abaaso.com
* @module abaaso
* @version 3.11.11
* @version 3.11.12
*/
( function ( global ) {

Expand Down Expand Up @@ -89,7 +89,7 @@ var regex = {
header_replace : /:.*/,
header_value_replace : /.*:\s+/,
html : /^<.*>$/,
http_body : /200|202|203|206/,
http_body : /200|201|202|203|206/,
http_ports : /80|443/,
ie : /msie|ie/i,
input_button : /button|submit|reset/,
Expand Down Expand Up @@ -2362,8 +2362,8 @@ var client = {
uri.fire( "after" + typed, r, xhr );
break;
case 201:
if ( ( o.headers.Location === undefined || string.isEmpty ( o.headers.Location ) ) && !string.isUrl ( r ) ) {
exception( new Error( label.error.invalidArguments ), xhr );
if ( ( o.headers.location === undefined || string.isEmpty( o.headers.location ) ) && !string.isUrl( r ) ) {
defer.resolve( r );
}
else {
redirect = string.trim ( o.headers.Location || r );
Expand All @@ -2373,7 +2373,6 @@ var client = {
}, function ( e ) {
exception( e, xhr );
} );
break;
}
break;
case 204:
Expand Down Expand Up @@ -2402,7 +2401,7 @@ var client = {
exception( new Error( label.error.serverInvalidMethod ), xhr );
break;
default:
exception( new Error( label.error.serverError ), xhr );
exception( new Error( xhr.responseText || label.error.serverError ), xhr );
break;
}

Expand Down Expand Up @@ -9672,8 +9671,6 @@ var utility = {
uri = !server ? location.href : "";
}

uri = decodeURIComponent( uri );

if ( !server ) {
obj = document.createElement( "a" );
obj.href = uri;
Expand Down Expand Up @@ -9796,26 +9793,22 @@ var utility = {
*/
queryString : function ( arg, qstring ) {
var obj = {},
result = qstring !== undefined ? ( qstring.indexOf( "?" ) > -1 ? qstring.replace( /.*\?/, "" ) : null) : ( server || string.isEmpty( location.search ) ? null : location.search.replace( "?", "" ) ),
item;
result = qstring !== undefined ? ( qstring.indexOf( "?" ) > -1 ? qstring.replace( /.*\?/, "" ) : null) : ( server || string.isEmpty( location.search ) ? null : location.search.replace( "?", "" ) );

if ( result !== null && !string.isEmpty( result ) ) {
result = result.split( "&" );
array.each( result, function (prop ) {
item = prop.split( "=" );
var item = prop.split( "=" );

if ( string.isEmpty( item[0] ) ) {
return;
}

if ( item[1] === undefined || string.isEmpty( item[1] ) ) {
if ( item[1] === undefined ) {
item[1] = "";
}
else if ( string.isNumber( item[1] )) {
item[1] = Number(item[1] );
}
else if ( string.isBoolean( item[1] )) {
item[1] = (item[1] === "true" );
else {
item[1] = utility.coerce( decodeURIComponent( item[1] ) );
}

if ( obj[item[0]] === undefined ) {
Expand Down Expand Up @@ -10174,7 +10167,7 @@ var xhr = function () {
XMLHttpRequest, headers, handler, handlerError, state;

headers = {
"User-Agent" : "abaaso/3.11.11 node.js/" + process.versions.node.replace( /^v/, "" ) + " (" + string.capitalize( process.platform ) + " V8/" + process.versions.v8 + " )",
"User-Agent" : "abaaso/3.11.12 node.js/" + process.versions.node.replace( /^v/, "" ) + " (" + string.capitalize( process.platform ) + " V8/" + process.versions.v8 + " )",
"Content-Type" : "text/plain",
"Accept" : "*/*"
};
Expand Down Expand Up @@ -10495,10 +10488,22 @@ var xhr = function () {

// Specifying Content-Length accordingly
if ( regex.put_post.test( this._params.method ) || regex.patch.test( this._params.method ) ) {
this._headers["Content-Length"] = data !== null ? Buffer.byteLength( data ) : 0;
if ( data === null ) {
this._headers["content-length"] = 0;
}
else if ( typeof data == "string" ) {
this._headers["content-length"] = Buffer.byteLength( data );
}
else if ( data instanceof Buffer || typeof data.toString == "function" ) {
data = data.toString();
this._headers["content-length"] = Buffer.byteLength( data );
}
else {
throw new Error( label.error.invalidArguments );
}
}

this._headers.Host = parsed.hostname + ( !regex.http_ports.test( parsed.port ) ? ":" + parsed.port : "" );
this._headers.Host = parsed.host;

options = {
hostname : parsed.hostname,
Expand Down Expand Up @@ -11316,7 +11321,7 @@ return {
update : element.update,
uuid : utility.uuid,
validate : validate.test,
version : "3.11.11",
version : "3.11.12",
walk : utility.walk,
when : utility.when
};
Expand Down
4 changes: 2 additions & 2 deletions lib/abaaso.map

Large diffs are not rendered by default.

Loading

0 comments on commit b473797

Please sign in to comment.