forked from hprose/hprose-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
85 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"author": "Ma Bingyao <[email protected]>", | ||
"name": "hprose", | ||
"version": "2.0.17", | ||
"version": "2.0.18", | ||
"description": "Hprose is a High Performance Remote Object Service Engine.", | ||
"keywords": [ | ||
"hprose", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Hprose for JavaScript v2.0.17 | ||
// Hprose for JavaScript v2.0.18 | ||
// Copyright (c) 2008-2016 http://hprose.com | ||
// Hprose is freely distributable under the MIT license. | ||
// For all details and documentation: | ||
|
@@ -6285,7 +6285,7 @@ | |
* * | ||
* hprose http client for JavaScript. * | ||
* * | ||
* LastModified: Sep 29, 2016 * | ||
* LastModified: Nov 6, 2016 * | ||
* Author: Ma Bingyao <[email protected]> * | ||
* * | ||
\**********************************************************/ | ||
|
@@ -6323,6 +6323,8 @@ | |
} | ||
catch (e) {} | ||
|
||
var wx = global.wx; | ||
|
||
var localfile = (global.location !== undefined && global.location.protocol === 'file:'); | ||
var nativeXHR = (typeof(XMLHttpRequest) !== 'undefined'); | ||
var corsSupport = (!localfile && nativeXHR && 'withCredentials' in new XMLHttpRequest()); | ||
|
@@ -6517,6 +6519,31 @@ | |
return future; | ||
} | ||
|
||
function wxPost(request, env) { | ||
var future = new Future(); | ||
var header = {}; | ||
for (var k in _header) { | ||
header[k] = _header[k]; | ||
} | ||
header['Content-Type'] = 'text/plain; charset=UTF-8'; | ||
wx.request({ | ||
url: self.uri(), | ||
method: 'POST', | ||
data: request, | ||
header: header, | ||
timeout: env.timeout, | ||
complete: function(ret) { | ||
if (ret.statusCode === 200) { | ||
future.resolve(ret.data); | ||
} | ||
else { | ||
future.reject(new Error(ret.statusCode + ":" + ret.data)); | ||
} | ||
} | ||
}); | ||
return future; | ||
} | ||
|
||
function isCrossDomain() { | ||
if (global.location === undefined) { | ||
return true; | ||
|
@@ -6537,7 +6564,9 @@ | |
(env.binary || isCrossDomain())); | ||
var apicloud = (typeof(global.api) !== "undefined" && | ||
typeof(global.api.ajax) !== "undefined"); | ||
var future = fhr ? fhrPost(request, env) : | ||
var wxreq = wx && wx.request; | ||
var future = wxreq ? wxPost(request, env) : | ||
fhr ? fhrPost(request, env) : | ||
apicloud ? apiPost(request, env) : | ||
deviceone ? deviceOnePost(request, env) : | ||
xhrPost(request, env); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
* * | ||
* hprose http client for JavaScript. * | ||
* * | ||
* LastModified: Sep 29, 2016 * | ||
* LastModified: Nov 6, 2016 * | ||
* Author: Ma Bingyao <[email protected]> * | ||
* * | ||
\**********************************************************/ | ||
|
@@ -50,6 +50,8 @@ | |
} | ||
catch (e) {} | ||
|
||
var wx = global.wx; | ||
|
||
var localfile = (global.location !== undefined && global.location.protocol === 'file:'); | ||
var nativeXHR = (typeof(XMLHttpRequest) !== 'undefined'); | ||
var corsSupport = (!localfile && nativeXHR && 'withCredentials' in new XMLHttpRequest()); | ||
|
@@ -244,6 +246,31 @@ | |
return future; | ||
} | ||
|
||
function wxPost(request, env) { | ||
var future = new Future(); | ||
var header = {}; | ||
for (var k in _header) { | ||
header[k] = _header[k]; | ||
} | ||
header['Content-Type'] = 'text/plain; charset=UTF-8'; | ||
wx.request({ | ||
url: self.uri(), | ||
method: 'POST', | ||
data: request, | ||
header: header, | ||
timeout: env.timeout, | ||
complete: function(ret) { | ||
if (ret.statusCode === 200) { | ||
future.resolve(ret.data); | ||
} | ||
else { | ||
future.reject(new Error(ret.statusCode + ":" + ret.data)); | ||
} | ||
} | ||
}); | ||
return future; | ||
} | ||
|
||
function isCrossDomain() { | ||
if (global.location === undefined) { | ||
return true; | ||
|
@@ -264,7 +291,9 @@ | |
(env.binary || isCrossDomain())); | ||
var apicloud = (typeof(global.api) !== "undefined" && | ||
typeof(global.api.ajax) !== "undefined"); | ||
var future = fhr ? fhrPost(request, env) : | ||
var wxreq = wx && wx.request; | ||
var future = wxreq ? wxPost(request, env) : | ||
fhr ? fhrPost(request, env) : | ||
apicloud ? apiPost(request, env) : | ||
deviceone ? deviceOnePost(request, env) : | ||
xhrPost(request, env); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.