aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Karneges <justin@affinix.com>2013-02-07 19:04:02 -0800
committerJustin Karneges <justin@affinix.com>2013-02-07 19:04:02 -0800
commit73fa51dfb85a1af72105b778932f58e51b0d8ac8 (patch)
tree22eeb4ad6c7cba08df109e7b637654496e67516a
parentc97ad8f5387261ba1d55d4e507c09a5b91de5fa2 (diff)
downloadpollymer-73fa51dfb85a1af72105b778932f58e51b0d8ac8.tar
pollymer-73fa51dfb85a1af72105b778932f58e51b0d8ac8.tar.gz
adjust json-p protocol
-rw-r--r--README8
-rw-r--r--polldance.js12
2 files changed, 10 insertions, 10 deletions
diff --git a/README b/README
index e2dd87d..0b4b1f5 100644
--- a/README
+++ b/README
@@ -141,7 +141,7 @@ JSON-P Protocol:
This library supports JSON-P by supplying the following query string
parameters in the request:
- _callback: the JavaScript function to call in the response script
+ callback: the JavaScript function to call in the response script
_method: the method name (default GET)
_headers: additional headers encoded as JSON (default none)
_body: request body (default empty)
@@ -152,8 +152,8 @@ JSON-P Protocol:
The server is expected to reply with a JSON object with fields:
- code: the HTTP response code
- status: the HTTP response status
+ code: the HTTP response status code
+ reason: the HTTP response reason phrase
headers: any noteworthy HTTP response headers (default none)
body: response body
@@ -161,7 +161,7 @@ JSON-P Protocol:
{
"code": 200,
- "status": "OK",
+ "reason": "OK",
"headers": {
"Content-Type": "application/json"
},
diff --git a/polldance.js b/polldance.js
index 4af64e2..3e729aa 100644
--- a/polldance.js
+++ b/polldance.js
@@ -357,18 +357,18 @@ var DEBUG = true;
consoleInfo("PD: XHR finished");
var code = xhr.status;
- var status = xhr.statusText;
+ var reason = xhr.statusText;
var headers = parseResponseHeaders(xhr.getAllResponseHeaders());
var body = xhr.responseText;
- this._handleResponse(code, status, headers, body);
+ this._handleResponse(code, reason, headers, body);
}
};
Request.prototype._startJsonp = function (method, url, headers, body) {
var jsonp = jsonCallbacks.newCallbackInfo();
var paramList = [
- "_callback=" + encodeURIComponent("window['" + NAMESPACE + "']._getJsonpCallback(\"" + jsonp.id + "\")")
+ "callback=" + encodeURIComponent("window['" + NAMESPACE + "']._getJsonpCallback(\"" + jsonp.id + "\")")
];
if (method != "GET") {
@@ -401,13 +401,13 @@ var DEBUG = true;
consoleInfo("PD: json-p " + this._jsonp.id + " finished");
var code = ("code" in result) ? result.code : 0;
- var status = ("status" in result) ? result.status : null;
+ var reason = ("reason" in result) ? result.reason : null;
var headers = ("headers" in result) ? result.headers : {};
var body = ("body" in result) ? result.body : null;
- this._handleResponse(code, status, headers, body);
+ this._handleResponse(code, reason, headers, body);
};
- Request.prototype._handleResponse = function (code, status, headers, body) {
+ Request.prototype._handleResponse = function (code, reason, headers, body) {
this._cleanupConnect();
if ((code == 0 || (code >= 500 && code < 600)) &&