mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Ready use the JSON-RPC 2.0 based stateless proxy
This commit is contained in:
parent
43b5781cbd
commit
ac31e5e884
20
lib/http.js
20
lib/http.js
|
@ -490,9 +490,21 @@ var HTTPObject = function(engine) {
|
|||
}
|
||||
|
||||
if (this.proxy.type == "stateless-jsonrpc2") {
|
||||
// todo
|
||||
data = JSON.stringify(
|
||||
JsonRpc2.wrap(this.proxy.rpcMethod, {
|
||||
"method": this.proxy.method,
|
||||
"url": url,
|
||||
"headers": this.getRequestHeaders(function(x) {
|
||||
return Object.keys(x).reduce(function(a, k) {
|
||||
a.push(x[k]);
|
||||
return a;
|
||||
}, []);
|
||||
}),
|
||||
"data": data
|
||||
}, "")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
|
@ -618,7 +630,7 @@ var HTTPObject = function(engine) {
|
|||
console.log("Use the engine:", this.engine);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("HTTPObject.open() ->", e.message);
|
||||
console.error("Exception on HTTPObject.open():", e.message);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -1283,7 +1295,7 @@ exports.parseURL = parseURL;
|
|||
exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
|
||||
exports.defaultUserAgent = DEFAULT_USER_AGENT; // compatible
|
||||
|
||||
exports.VERSIONINFO = "HTTP Client for WelsonJS framework (http.js) version 0.7.41";
|
||||
exports.VERSIONINFO = "HTTP Client for WelsonJS framework (http.js) version 0.7.42";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user