mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Treating API urls as external in cells
Summary: Links for the API endpoints in a cell didn't work as they were interpreted as internal routes. Now they are properly detected as external. Test Plan: Added new test Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D4078
This commit is contained in:
@@ -90,6 +90,12 @@ describe('gristUrlState', function() {
|
||||
// Billing routes
|
||||
assert.deepEqual(prod.decodeUrl(new URL('https://bar.example.com/o/baz/billing')),
|
||||
{org: 'baz', billing: 'billing'});
|
||||
|
||||
// API routes
|
||||
assert.deepEqual(prod.decodeUrl(new URL('https://bar.example.com/api/docs/bar')),
|
||||
{org: 'bar', doc: 'bar', api: true});
|
||||
assert.deepEqual(prod.decodeUrl(new URL('http://localhost:8080/o/baz/api/docs/bar')),
|
||||
{org: 'baz', doc: 'bar', api: true});
|
||||
});
|
||||
|
||||
it('should decode query strings in URLs correctly', function() {
|
||||
@@ -139,6 +145,11 @@ describe('gristUrlState', function() {
|
||||
// Billing routes
|
||||
assert.equal(prod.encodeUrl({org: 'baz', billing: 'billing'}, hostBase),
|
||||
'https://baz.example.com/billing');
|
||||
|
||||
// API routes
|
||||
assert.equal(prod.encodeUrl({org: 'baz', doc: 'bar', api: true}, hostBase), 'https://baz.example.com/api/docs/bar');
|
||||
assert.equal(prod.encodeUrl({org: 'baz', doc: 'bar', api: true}, localBase),
|
||||
'http://localhost:8080/o/baz/api/docs/bar');
|
||||
});
|
||||
|
||||
it('should encode state in billing URLs correctly', function() {
|
||||
|
||||
Reference in New Issue
Block a user