Skip to content

Commit

Permalink
feat: Remove deprecation DEPPS4: Remove convenience method for http…
Browse files Browse the repository at this point in the history
… request `Parse.Cloud.httpRequest` (#8287)

BREAKING CHANGE: The convenience method for HTTP requests `Parse.Cloud.httpRequest` is removed; use your preferred 3rd party library for making HTTP requests
  • Loading branch information
dblythy authored Nov 10, 2022
1 parent 739a3a9 commit 2d79c08
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 252 deletions.
2 changes: 1 addition & 1 deletion DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The following is a list of deprecations, according to the [Deprecation Policy](h
| DEPPS1 | Native MongoDB syntax in aggregation pipeline | [#7338](https://github.com/parse-community/parse-server/issues/7338) | 5.0.0 (2022) | 6.0.0 (2023) | deprecated | - |
| DEPPS2 | Config option `directAccess` defaults to `true` | [#6636](https://github.com/parse-community/parse-server/pull/6636) | 5.0.0 (2022) | 6.0.0 (2023) | deprecated | - |
| DEPPS3 | Config option `enforcePrivateUsers` defaults to `true` | [#7319](https://github.com/parse-community/parse-server/pull/7319) | 5.0.0 (2022) | 6.0.0 (2023) | deprecated | - |
| DEPPS4 | Remove convenience method for http request `Parse.Cloud.httpRequest` | [#7589](https://github.com/parse-community/parse-server/pull/7589) | 5.0.0 (2022) | 6.0.0 (2023) | deprecated | - |
| DEPPS4 | Remove convenience method for http request `Parse.Cloud.httpRequest` | [#7589](https://github.com/parse-community/parse-server/pull/7589) | 5.0.0 (2022) | 6.0.0 (2023) | removed | - |
| DEPPS5 | Config option `allowClientClassCreation` defaults to `false` | [#7925](https://github.com/parse-community/parse-server/pull/7925) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
| DEPPS6 | Auth providers disabled by default | [#7953](https://github.com/parse-community/parse-server/pull/7953) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
| DEPPS7 | Remove file trigger syntax `Parse.Cloud.beforeSaveFile((request) => {})` | [#7966](https://github.com/parse-community/parse-server/pull/7966) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
Expand Down
19 changes: 0 additions & 19 deletions spec/CloudCode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1686,25 +1686,6 @@ 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(() => {
Expand Down
4 changes: 2 additions & 2 deletions spec/HTTPRequest.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const httpRequest = require('../lib/cloud-code/httpRequest'),
HTTPResponse = require('../lib/cloud-code/HTTPResponse').default,
const httpRequest = require('../lib/request'),
HTTPResponse = require('../lib/request').HTTPResponse,
bodyParser = require('body-parser'),
express = require('express');

Expand Down
2 changes: 1 addition & 1 deletion spec/ParseGeoPoint.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Parse.GeoPoint testing', () => {
obj.set('location', point);
obj.set('name', 'Zhoul');
await obj.save();
Parse.Cloud.httpRequest({
request({
url: 'http://localhost:8378/1/classes/TestObject/' + obj.id,
headers: {
'X-Parse-Application-Id': 'test',
Expand Down
61 changes: 0 additions & 61 deletions src/cloud-code/HTTPResponse.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/cloud-code/Parse.Cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,15 +713,6 @@ ParseCloud.useMasterKey = () => {
);
};

const request = require('./httpRequest');
ParseCloud.httpRequest = opts => {
Deprecator.logRuntimeDeprecation({
usage: 'Parse.Cloud.httpRequest',
solution: 'Use a http request library instead.',
});
return request(opts);
};

module.exports = ParseCloud;

/**
Expand Down
158 changes: 0 additions & 158 deletions src/cloud-code/httpRequest.js

This file was deleted.

Loading

0 comments on commit 2d79c08

Please sign in to comment.