Skip to content

Commit

Permalink
fix (wfs, wms, wmts): support urls ending with or without ? character
Browse files Browse the repository at this point in the history
  • Loading branch information
jailln committed Nov 8, 2022
1 parent f3bd6c7 commit f44dfb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/Source/WFSSource.js
Expand Up @@ -124,6 +124,10 @@ class WFSSource extends Source {
this.typeName = source.typeName;
this.version = source.version || '2.0.2';

// Add ? at the end of the url if it is not already in the given URL
if (!this.url.endsWith('?')) {
this.url = `${this.url}?`;
}
this.url = `${source.url
}SERVICE=WFS&REQUEST=GetFeature&typeName=${this.typeName
}&VERSION=${this.version
Expand Down
6 changes: 5 additions & 1 deletion src/Source/WMSSource.js
Expand Up @@ -114,7 +114,11 @@ class WMSSource extends Source {

const crsPropName = (this.version === '1.3.0') ? 'CRS' : 'SRS';

this.url = `${source.url}?SERVICE=WMS&REQUEST=GetMap&LAYERS=${
// Add ? at the end of the url if it is not already in the given URL
if (!this.url.endsWith('?')) {
this.url = `${this.url}?`;
}
this.url = `${this.url}SERVICE=WMS&REQUEST=GetMap&LAYERS=${
this.name}&VERSION=${
this.version}&STYLES=${
this.style}&FORMAT=${
Expand Down
7 changes: 6 additions & 1 deletion src/Source/WMTSSource.js
Expand Up @@ -70,8 +70,13 @@ class WMTSSource extends TMSSource {
super(source);

this.isWMTSSource = true;

// Add ? at the end of the url if it is not already in the given URL
if (!this.url.endsWith('?')) {
this.url = `${this.url}?`;
}
this.url = `${this.url}` +
`?LAYER=${source.name}` +
`LAYER=${source.name}` +
`&FORMAT=${this.format}` +
'&SERVICE=WMTS' +
`&VERSION=${source.version || '1.0.0'}` +
Expand Down

0 comments on commit f44dfb2

Please sign in to comment.