Skip to content

Remove request and request-promise from dev dependencies #5077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9b5b97c
removes from emailverificationtoken spec
flovilmart Sep 23, 2018
40a276e
updates winston
flovilmart Sep 23, 2018
af1f6c9
Updates ValidationAndPasswordsReset
flovilmart Sep 23, 2018
cba06a1
Use local request in schemas
flovilmart Sep 23, 2018
5bb9d1b
Removes request in rest.spec
flovilmart Sep 23, 2018
8bca156
Removes request from PushRouter0
flovilmart Sep 23, 2018
5a6d3d9
removes request from public API
flovilmart Sep 23, 2018
9606505
removes request from index.spec
flovilmart Sep 23, 2018
99f2d9c
Removes request form parse.push spec
flovilmart Sep 23, 2018
c04222b
removes request from ParseInstallation spec
flovilmart Sep 23, 2018
fb1841a
Removes from ParseHooks
flovilmart Sep 23, 2018
dd441bf
removes request from ParseGlobalConfig.spec
flovilmart Sep 23, 2018
c3767d6
Removes request from ParseAPI.spec.js
flovilmart Sep 23, 2018
0ad79bb
removes request from LogsRouter
flovilmart Sep 23, 2018
58a8f81
removes in features
flovilmart Sep 23, 2018
7bcc72e
Filters undefined headers instead of crashing
flovilmart Sep 24, 2018
d5ba189
Removes request from ParseUser spec
flovilmart Sep 24, 2018
5403a97
Removes usage of request in ParseFile.spec.js
flovilmart Sep 24, 2018
619df19
Removes request from AuthAdapters.js
flovilmart Sep 24, 2018
52abf39
removes request-promise from ParseGeoPoint.spec
flovilmart Sep 24, 2018
2aca216
Removes request-promise from ParseQuery spec
flovilmart Sep 24, 2018
1f64579
remove request-promise from UserPII
flovilmart Sep 24, 2018
5d27a32
removes request-promise from EnableExpressErrorHandler
flovilmart Sep 24, 2018
1a6a53e
Updates RevocableSessionUpgrade spec
flovilmart Sep 24, 2018
6ea82fe
Update RestQuery
flovilmart Sep 24, 2018
3c6b238
Removes read preferenceOptionM
flovilmart Sep 24, 2018
7495d1b
ensure we forward auth from URL
flovilmart Sep 24, 2018
2d2dca1
use request in CloudCode.spec.js
flovilmart Sep 24, 2018
5d570ef
Removes request-promise from JobSchedule.spec
flovilmart Sep 24, 2018
3e669c4
Removes rp from VerifyUserPassword.spec.js
flovilmart Sep 24, 2018
fbcba5b
Removes rp from PasswordPolicy spec
flovilmart Sep 24, 2018
0a8451d
Removes rp from ParsePolygon spec
flovilmart Sep 24, 2018
fd7a87f
Removes rp from fullTextSearch spec
flovilmart Sep 24, 2018
ff2cff1
Removes rp from PArseQuery.Aggregate
flovilmart Sep 24, 2018
d667d10
Ensure we properly forward errors
flovilmart Sep 24, 2018
535900b
Removes request and request-promise
flovilmart Sep 24, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,733 changes: 1,358 additions & 3,375 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@
"nodemon": "1.18.4",
"nyc": "^12.0.2",
"prettier": "1.14.3",
"request": "2.88.0",
"request-promise": "4.2.2",
"supports-color": "^5.4.0"
},
"scripts": {
Expand Down
29 changes: 18 additions & 11 deletions spec/AuthenticationAdapters.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const request = require('request');
const request = require('../lib/request');
const Config = require('../lib/Config');
const defaultColumns = require('../lib/Controllers/SchemaController')
.defaultColumns;
Expand Down Expand Up @@ -143,6 +143,7 @@ describe('AuthenticationProviders', function() {
};

const options = {
method: 'POST',
headers: {
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest',
Expand All @@ -152,17 +153,23 @@ describe('AuthenticationProviders', function() {
},
url: 'http://localhost:8378/1/users',
body: jsonBody,
json: true,
};

return new Promise(resolve => {
request.post(options, (err, res, body) => {
resolve({ err, res, body });
return request(options)
.then(response => {
if (callback) {
callback(null, response, response.data);
}
return {
res: response,
body: response.data,
};
})
.catch(error => {
if (callback) {
callback(err, res, body);
callback(error);
}
throw error;
});
});
};

it('should create user with REST API', done => {
Expand Down Expand Up @@ -226,9 +233,9 @@ describe('AuthenticationProviders', function() {
.then(user => {
return createOAuthUserWithSessionToken(user.getSessionToken());
})
.then(({ body }) => {
expect(body.code).toBe(208);
expect(body.error).toBe('this auth is already used');
.then(fail, ({ data }) => {
expect(data.code).toBe(208);
expect(data.error).toBe('this auth is already used');
done();
})
.catch(done.fail);
Expand Down
59 changes: 31 additions & 28 deletions spec/CloudCode.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const Parse = require('parse/node');
const rp = require('request-promise');
const request = require('../lib/request');
const InMemoryCacheAdapter = require('../lib/Adapters/Cache/InMemoryCacheAdapter')
.InMemoryCacheAdapter;

Expand Down Expand Up @@ -880,26 +880,23 @@ describe('Cloud Code', () => {
})
.then(user => {
session1 = user.getSessionToken();
return rp({
uri: 'http://localhost:8378/1/login?username=test&password=moon-y',
json: true,
return request({
url: 'http://localhost:8378/1/login?username=test&password=moon-y',
headers: {
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest',
},
});
})
.then(body => {
session2 = body.sessionToken;

.then(response => {
session2 = response.data.sessionToken;
//Ensure both session tokens are in the cache
return Parse.Cloud.run('checkStaleUser');
return Parse.Cloud.run('checkStaleUser', { sessionToken: session2 });
})
.then(() =>
rp({
request({
method: 'POST',
uri: 'http://localhost:8378/1/functions/checkStaleUser',
json: true,
url: 'http://localhost:8378/1/functions/checkStaleUser',
headers: {
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest',
Expand All @@ -922,22 +919,21 @@ describe('Cloud Code', () => {
return user.save();
})
.then(() =>
rp({
request({
method: 'POST',
uri: 'http://localhost:8378/1/functions/checkStaleUser',
json: true,
url: 'http://localhost:8378/1/functions/checkStaleUser',
headers: {
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest',
'X-Parse-Session-Token': session2,
},
})
)
.then(body => {
expect(body.result).toEqual('second data');
.then(response => {
expect(response.data.result).toEqual('second data');
done();
})
.catch(done.fail);
.catch(e => done.fail(e));
});

it('trivial beforeSave should not affect fetched pointers (regression test for #1238)', done => {
Expand Down Expand Up @@ -1196,7 +1192,8 @@ describe('Cloud Code', () => {
Parse.Cloud.job('myJob', () => {});
}).not.toThrow();

rp.post({
request({
method: 'POST',
url: 'http://localhost:8378/1/jobs/myJob',
headers: {
'X-Parse-Application-Id': Parse.applicationId,
Expand All @@ -1218,7 +1215,8 @@ describe('Cloud Code', () => {
Parse.Cloud.job('myJob', () => {});
}).not.toThrow();

rp.post({
request({
method: 'POST',
url: 'http://localhost:8378/1/jobs/myJob',
headers: {
'X-Parse-Application-Id': Parse.applicationId,
Expand All @@ -1230,7 +1228,7 @@ describe('Cloud Code', () => {
done();
},
err => {
expect(err.statusCode).toBe(403);
expect(err.status).toBe(403);
done();
}
);
Expand All @@ -1248,7 +1246,8 @@ describe('Cloud Code', () => {
});
}).not.toThrow();

rp.post({
request({
method: 'POST',
url: 'http://localhost:8378/1/jobs/myJob',
headers: {
'X-Parse-Application-Id': Parse.applicationId,
Expand All @@ -1275,7 +1274,8 @@ describe('Cloud Code', () => {
});
}).not.toThrow();

rp.post({
request({
method: 'POST',
url: `http://${Parse.applicationId}:${
Parse.masterKey
}@localhost:8378/1/jobs/myJob`,
Expand Down Expand Up @@ -1317,7 +1317,8 @@ describe('Cloud Code', () => {
return promise;
});

rp.post({
request({
method: 'POST',
url: 'http://localhost:8378/1/jobs/myJob',
headers: {
'X-Parse-Application-Id': Parse.applicationId,
Expand Down Expand Up @@ -1351,7 +1352,8 @@ describe('Cloud Code', () => {
return promise;
});

rp.post({
request({
method: 'POST',
url: 'http://localhost:8378/1/jobs/myJob',
headers: {
'X-Parse-Application-Id': Parse.applicationId,
Expand Down Expand Up @@ -1580,7 +1582,7 @@ describe('beforeFind hooks', () => {
return Parse.Query.or(req.query, otherQuery);
});

rp.get({
request({
url: 'http://localhost:8378/1/classes/MyObject',
headers: {
'X-Parse-Application-Id': Parse.applicationId,
Expand Down Expand Up @@ -1639,15 +1641,16 @@ describe('beforeFind hooks', () => {
const obj = new Parse.Object('MyObject');
obj.set('secretField', 'SSID');
obj.save().then(function() {
rp({
request({
method: 'GET',
uri: 'http://localhost:8378/1/classes/MyObject/' + obj.id,
url: 'http://localhost:8378/1/classes/MyObject/' + obj.id,
headers: {
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest',
},
json: true,
}).then(body => {
}).then(response => {
const body = response.data;
expect(body.secretField).toEqual('SSID');
expect(hook.method).toHaveBeenCalled();
done();
Expand Down
Loading