summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/login_spec.js8
-rw-r--r--spec/signup_spec.js2
-rw-r--r--src/jqueryRest.js6
3 files changed, 8 insertions, 8 deletions
diff --git a/spec/login_spec.js b/spec/login_spec.js
index 16a63d0..e806cff 100644
--- a/spec/login_spec.js
+++ b/spec/login_spec.js
@@ -45,9 +45,9 @@ describe("Login with srp var", function() {
srp.loggedIn = sinon.spy();
srp.login();
- this.expectRequest('sessions.json', 'login=' +login+ '&A=' +A, 'POST');
+ this.expectRequest('/sessions.json', 'login=' +login+ '&A=' +A, 'POST');
this.respondJSON({salt: salt, B: B});
- this.expectRequest('sessions/'+login+'.json', 'client_auth='+M, 'PUT');
+ this.expectRequest('/sessions/'+login+'.json', 'client_auth='+M, 'PUT');
this.respondJSON({M2: M2});
expect(srp.loggedIn).toHaveBeenCalled();
@@ -58,7 +58,7 @@ describe("Login with srp var", function() {
var error = {login: "something went wrong on the server side"};
srp.login();
- this.expectRequest('sessions.json', 'login=' +login+ '&A=' +A, 'POST');
+ this.expectRequest('/sessions.json', 'login=' +login+ '&A=' +A, 'POST');
this.respondJSON(error, 422);
//this.expectNoMoreRequests();
@@ -72,7 +72,7 @@ describe("Login with srp var", function() {
srp.error = sinon.spy();
srp.login();
- this.expectRequest('sessions.json', 'login=' +login+ '&A=' +A, 'POST');
+ this.expectRequest('/sessions.json', 'login=' +login+ '&A=' +A, 'POST');
this.respondJSON({salt: salt, B: 0});
// aborting if B=0
expect(this.requests).toEqual([]);
diff --git a/spec/signup_spec.js b/spec/signup_spec.js
index 41af179..72689b1 100644
--- a/spec/signup_spec.js
+++ b/spec/signup_spec.js
@@ -25,7 +25,7 @@ describe("Signup with srp var", function() {
srp.signedUp = callback;
srp.session.getSalt = function() {return "4c78c3f8"};
srp.signup();
- this.expectRequest('users.json', "user[login]=testuser&user[password_salt]=4c78c3f8&user[password_verifier]=474c26aa42d11f20544a00f7bf9711c4b5cf7aab95ed448df82b95521b96668e7480b16efce81c861870302560ddf6604c67df54f1d04b99d5bb9d0f02c6051ada5dc9d594f0d4314e12f876cfca3dcd99fc9c98c2e6a5e04298b11061fb8549a22cde0564e91514080df79bca1c38c682214d65d590f66b3719f954b078b83c", 'POST')
+ this.expectRequest('/users.json', "user[login]=testuser&user[password_salt]=4c78c3f8&user[password_verifier]=474c26aa42d11f20544a00f7bf9711c4b5cf7aab95ed448df82b95521b96668e7480b16efce81c861870302560ddf6604c67df54f1d04b99d5bb9d0f02c6051ada5dc9d594f0d4314e12f876cfca3dcd99fc9c98c2e6a5e04298b11061fb8549a22cde0564e91514080df79bca1c38c682214d65d590f66b3719f954b078b83c", 'POST')
this.respondJSON({password_salt: "4c78c3f8", login: "testuser", ok: "true"});
expect(callback).toHaveBeenCalled();
});
diff --git a/src/jqueryRest.js b/src/jqueryRest.js
index c4b0161..1a60385 100644
--- a/src/jqueryRest.js
+++ b/src/jqueryRest.js
@@ -3,16 +3,16 @@ srp.remote = (function(){
// we do not fetch the salt from the server
function register(session) {
- return $.post("users.json", { user: session.signup() });
+ return $.post("/users.json", { user: session.signup() });
}
function handshake(session) {
- return $.post("sessions.json", session.handshake());
+ return $.post("/sessions.json", session.handshake());
}
function authenticate(session) {
return $.ajax({
- url: "sessions/" + session.getI() + ".json",
+ url: "/sessions/" + session.getI() + ".json",
type: 'PUT',
data: {client_auth: session.getM()}
});