Skip to content

Commit b39c138

Browse files
committed
fix tests
1 parent c5d9387 commit b39c138

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

spec/ParseUser.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2459,7 +2459,7 @@ describe('Parse.User testing', () => {
24592459
'X-Parse-REST-API-Key': 'rest',
24602460
},
24612461
url: 'http://localhost:8378/1/sessions/' + b.objectId,
2462-
body: JSON.stringify({ foo: 'bar' }),
2462+
body: { foo: 'bar' },
24632463
}).then(() => {
24642464
done();
24652465
});

spec/RegexVulnerabilities.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ describe('Regex Vulnerabilities', function () {
137137
await request({
138138
url: `${serverURL}/apps/test/request_password_reset`,
139139
method: 'POST',
140-
body: {
140+
body: JSON.stringify({
141141
token: { $regex: '' },
142142
username: '[email protected]',
143143
new_password: 'newpassword',
144-
},
144+
}),
145145
});
146146
try {
147147
await Parse.User.logIn('[email protected]', 'newpassword');
@@ -174,7 +174,7 @@ describe('Regex Vulnerabilities', function () {
174174
expect(passwordResetResponse.headers.location).toMatch(
175175
`\\/choose\\_password\\?token\\=${token}\\&`
176176
);
177-
await request({
177+
await request.legacy({
178178
url: `${serverURL}/apps/test/request_password_reset`,
179179
method: 'POST',
180180
body: {

spec/ValidationAndPasswordsReset.spec.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -690,20 +690,22 @@ describe('Custom Pages, Email Verification, Password Reset', () => {
690690
},
691691
publicServerURL: 'http://localhost:8378/1',
692692
}).then(() => {
693-
request({
694-
url: 'http://localhost:8378/1/apps/test/resend_verification_email',
695-
method: 'POST',
696-
followRedirects: false,
697-
body: {
698-
username: 'sadfasga',
699-
},
700-
}).then(response => {
701-
expect(response.status).toEqual(302);
702-
expect(response.text).toEqual(
703-
'Found. Redirecting to http://localhost:8378/1/apps/link_send_fail.html'
704-
);
705-
done();
706-
});
693+
request
694+
.legacy({
695+
url: 'http://localhost:8378/1/apps/test/resend_verification_email',
696+
method: 'POST',
697+
followRedirects: false,
698+
body: {
699+
username: 'sadfasga',
700+
},
701+
})
702+
.then(response => {
703+
expect(response.status).toEqual(302);
704+
expect(response.text).toEqual(
705+
'Found. Redirecting to http://localhost:8378/1/apps/link_send_fail.html'
706+
);
707+
done();
708+
});
707709
});
708710
});
709711

@@ -975,7 +977,7 @@ describe('Custom Pages, Email Verification, Password Reset', () => {
975977
followRedirects: false,
976978
});
977979
expect(resetResponse.status).toEqual(200);
978-
expect(resetResponse.text).toEqual('"Password successfully reset"');
980+
expect(resetResponse.text).toEqual('Password successfully reset');
979981

980982
await Parse.User.logIn('zxcv', 'hello');
981983
const config = Config.get('test');

src/cloud-code/httpRequest.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ module.exports = async options => {
129129
e.text = data;
130130
}
131131
e.buffer = Buffer.from(e.text);
132+
if (e.response && e.response.headers) {
133+
e.headers = e.response.headers;
134+
}
132135
if (e.status === 301 || e.status === 302 || e.status === 303) {
133136
return e;
134137
}

0 commit comments

Comments
 (0)