fix: add deprecation warning for Parse.Cloud.httpRequest (#7595)

This commit is contained in:
dblythy
2021-10-09 14:04:12 +11:00
committed by GitHub
parent 68a3a87501
commit ab1dddd406
4 changed files with 30 additions and 1 deletions

View File

@@ -1554,6 +1554,25 @@ describe('Cloud Code', () => {
obj.save().then(done, done.fail);
});
it('can deprecate Parse.Cloud.httpRequest', async () => {
const logger = require('../lib/logger').logger;
spyOn(logger, 'warn').and.callFake(() => {});
Parse.Cloud.define('hello', () => {
return 'Hello world!';
});
await Parse.Cloud.httpRequest({
method: 'POST',
url: 'http://localhost:8378/1/functions/hello',
headers: {
'X-Parse-Application-Id': Parse.applicationId,
'X-Parse-REST-API-Key': 'rest',
},
});
expect(logger.warn).toHaveBeenCalledWith(
'DeprecationWarning: Parse.Cloud.httpRequest is deprecated and will be removed in a future version. Use a http request library instead.'
);
});
describe('cloud jobs', () => {
it('should define a job', done => {
expect(() => {