From 3bf101bc1ef3b5a58fe2f1e2a2e7a681f6de6c09 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 30 Oct 2012 15:09:13 +0100 Subject: we're expecting json responses - so put .json in the url --- src/jqueryRest.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/jqueryRest.js') diff --git a/src/jqueryRest.js b/src/jqueryRest.js index f50080b..133e3fd 100644 --- a/src/jqueryRest.js +++ b/src/jqueryRest.js @@ -54,7 +54,7 @@ jqueryRest = function() { function sendVerifier(session, callback) { var salt = session.getSalt(); - $.post("users", { user: + $.post("users.json", { user: { login: session.getI(), password_salt: salt, password_verifier: session.getV(salt).toString(16)} @@ -62,13 +62,13 @@ jqueryRest = function() { } function handshake(session, callback) { - $.post("sessions", { login: session.getI(), + $.post("sessions.json", { login: session.getI(), A: session.getAstr()}, callback); } function authenticate(session, success) { $.ajax({ - url: "sessions/" + session.getI(), + url: "sessions/" + session.getI() + ".json", type: 'PUT', data: {client_auth: session.getM()}, success: success -- cgit v1.2.3 From 47c7a78e948f139074ec8d975cdd38cc3335253d Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 14 Nov 2012 12:28:36 +0100 Subject: cleaned up unused parser functions --- src/jqueryRest.js | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) (limited to 'src/jqueryRest.js') diff --git a/src/jqueryRest.js b/src/jqueryRest.js index 133e3fd..54a0908 100644 --- a/src/jqueryRest.js +++ b/src/jqueryRest.js @@ -1,51 +1,5 @@ jqueryRest = function() { - function parseResponse() { - if (responseIsXML()) { - return parseXML(xhr.responseXML); - } else if (responseIsJSON()) { - return JSON.parse(xhr.responseText); - } - } - - function responseIsXML() { - return (xhr.responseType == 'document') || - (xhr.getResponseHeader("Content-Type").indexOf('application/xml') >= 0); - } - - function responseIsJSON() { - return (xhr.responseType == 'json') || - (xhr.getResponseHeader("Content-Type").indexOf('application/json') >= 0); - } - - function parseXML(xml) { - if (xml.getElementsByTagName("r").length > 0) { - return parseAttributesOfElement(xml.getElementsByTagName("r")[0]); - } else { - return parseNodes(xml.childNodes); - } - } - - function parseAttributesOfElement(elem) { - var response = {}; - for (var i = 0; i < elem.attributes.length; i++) { - var attrib = elem.attributes[i]; - if (attrib.specified) { - response[attrib.name] = attrib.value; - } - } - return response; - } - - function parseNodes(nodes) { - var response = {}; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - response[node.tagName] = node.textContent || true; - } - return response; - } - // we do not fetch the salt from the server function register(session, callback) { -- cgit v1.2.3