diff --git a/libs/feature/dataviz/src/lib/service/data.service.spec.ts b/libs/feature/dataviz/src/lib/service/data.service.spec.ts index ee9944f100..cb126ef076 100644 --- a/libs/feature/dataviz/src/lib/service/data.service.spec.ts +++ b/libs/feature/dataviz/src/lib/service/data.service.spec.ts @@ -593,11 +593,22 @@ describe('DataService', () => { it('builds a proxied url', () => { expect( service.getDownloadUrlFromEsriRest( - 'http://esri.rest/local/', + 'http://esri.rest/local', 'geojson' ) ).toBe( - 'http://proxy.local/?url=http%3A%2F%2Fesri.rest%2Flocal%2F%2Fquery%3Ff%3Dgeojson%26where%3D1%3D1%26outFields%3D*' + 'http://proxy.local/?url=http%3A%2F%2Fesri.rest%2Flocal%2Fquery%3Ff%3Dgeojson%26where%3D1%3D1%26outFields%3D*' + ) + }) + it('calls DataFetcher.openDataset with a proxied url', () => { + service.getDataset({ + url: new URL('http://esri.rest/local'), + accessServiceProtocol: 'esriRest', + type: 'service', + }) + expect(openDataset).toHaveBeenCalledWith( + 'http://proxy.local/?url=http%3A%2F%2Fesri.rest%2Flocal%2Fquery%3Ff%3Dgeojson%26where%3D1%3D1%26outFields%3D*', + 'geojson' ) }) }) diff --git a/libs/feature/dataviz/src/lib/service/data.service.ts b/libs/feature/dataviz/src/lib/service/data.service.ts index 5ed9dffad2..236a1ec3c6 100644 --- a/libs/feature/dataviz/src/lib/service/data.service.ts +++ b/libs/feature/dataviz/src/lib/service/data.service.ts @@ -197,7 +197,10 @@ export class DataService { link.type === 'service' && link.accessServiceProtocol === 'esriRest' ) { - const url = this.getDownloadUrlFromEsriRest(linkUrl, 'geojson') + const url = this.getDownloadUrlFromEsriRest( + link.url.toString(), //let getDownloadUrlFromEsriRest() proxy url with params + 'geojson' + ) return from(openDataset(url, 'geojson')).pipe() } return throwError(() => 'protocol not supported')