* fix: detect if the caller is accessing us via local or parse for batch requests (#6980) * chore: minor cleanup from PR
This commit is contained in:
@@ -9,6 +9,7 @@ const serverURL1 = 'http://localhost:1234/1';
|
||||
const serverURLNaked = 'http://localhost:1234/';
|
||||
const publicServerURL = 'http://domain.com/parse';
|
||||
const publicServerURLNaked = 'http://domain.com/';
|
||||
const publicServerURLLong = 'https://domain.com/something/really/long';
|
||||
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -24,6 +25,26 @@ describe('batch', () => {
|
||||
expect(internalURL).toEqual('/classes/Object');
|
||||
});
|
||||
|
||||
it('should return the proper url given a public url-only path', () => {
|
||||
const originalURL = '/something/really/long/batch';
|
||||
const internalURL = batch.makeBatchRoutingPathFunction(
|
||||
originalURL,
|
||||
serverURL,
|
||||
publicServerURLLong
|
||||
)('/parse/classes/Object');
|
||||
expect(internalURL).toEqual('/classes/Object');
|
||||
});
|
||||
|
||||
it('should return the proper url given a server url-only path', () => {
|
||||
const originalURL = '/parse/batch';
|
||||
const internalURL = batch.makeBatchRoutingPathFunction(
|
||||
originalURL,
|
||||
serverURL,
|
||||
publicServerURLLong
|
||||
)('/parse/classes/Object');
|
||||
expect(internalURL).toEqual('/classes/Object');
|
||||
});
|
||||
|
||||
it('should return the proper url same public/local endpoint', () => {
|
||||
const originalURL = '/parse/batch';
|
||||
const internalURL = batch.makeBatchRoutingPathFunction(
|
||||
|
||||
Reference in New Issue
Block a user