This commit is contained in:
@@ -1345,4 +1345,30 @@ describe('miscellaneous', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('ignores _RevocableSession "header" send by JS SDK', (done) => {
|
||||
let object = new Parse.Object('AnObject');
|
||||
object.set('a', 'b');
|
||||
object.save().then(() => {
|
||||
request.post({
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
url: 'http://localhost:8378/1/classes/AnObject',
|
||||
body: {
|
||||
_method: 'GET',
|
||||
_ApplicationId: 'test',
|
||||
_JavaScriptKey: 'test',
|
||||
_ClientVersion: 'js1.8.3',
|
||||
_InstallationId: 'iid',
|
||||
_RevocableSession: "1",
|
||||
},
|
||||
json: true
|
||||
}, (err, res, body) => {
|
||||
expect(body.error).toBeUndefined();
|
||||
expect(body.results).not.toBeUndefined();
|
||||
expect(body.results.length).toBe(1);
|
||||
let result = body.results[0];
|
||||
expect(result.a).toBe('b');
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -167,7 +167,6 @@ describe('rest query', () => {
|
||||
expect(error).toBe(null);
|
||||
var b = JSON.parse(body);
|
||||
expect(b.code).toEqual(Parse.Error.INVALID_QUERY);
|
||||
expect(b.error).toEqual('Improper encode of parameter');
|
||||
done();
|
||||
});
|
||||
}).then(() => {
|
||||
@@ -185,7 +184,6 @@ describe('rest query', () => {
|
||||
expect(error).toBe(null);
|
||||
var b = JSON.parse(body);
|
||||
expect(b.code).toEqual(Parse.Error.INVALID_QUERY);
|
||||
expect(b.error).toEqual('Improper encode of parameter');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ export class ClassesRouter extends PromiseRouter {
|
||||
|
||||
for (let key of Object.keys(body)) {
|
||||
if (allowConstraints.indexOf(key) === -1) {
|
||||
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Improper encode of parameter');
|
||||
throw new Parse.Error(Parse.Error.INVALID_QUERY, `Invalid paramater for query: ${key}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ function handleParseHeaders(req, res, next) {
|
||||
fileViaJSON = true;
|
||||
}
|
||||
|
||||
if (req.body) {
|
||||
delete req.body._RevocableSession;
|
||||
}
|
||||
|
||||
if (req.body &&
|
||||
req.body._ApplicationId &&
|
||||
cache.apps.get(req.body._ApplicationId) &&
|
||||
|
||||
Reference in New Issue
Block a user