Skip to content

Commit 7ae940f

Browse files
committed
【bug】1) webmap,获取restData服务,没有根据传入的参数,对应带上cookie。导致没有权限
(reviewed by chengl)
1 parent cc280e3 commit 7ae940f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,7 @@ export class WebMap extends Observable {
19541954
url = layer.dataSource.url,
19551955
dataSourceName = dataSource.dataSourceName || layer.name;
19561956
let requestUrl = that.formatUrlWithCredential(url), serviceOptions = {};
1957+
serviceOptions.withCredentials = this.withCredentials;
19571958
if (!this.excludePortalProxyUrl && !CommonUtil.isInTheSameDomain(requestUrl)) {
19581959
serviceOptions.proxy = this.getProxy();
19591960
}
@@ -2049,7 +2050,7 @@ export class WebMap extends Observable {
20492050
try {
20502051
if (dataSource.type === 'PORTAL_DATA') {
20512052
const {dataMetaInfo} = await FetchRequest.get(`${this.server}web/datas/${dataSource.serverId}.json`, null, {
2052-
withCredentials: true
2053+
withCredentials: this.withCredentials
20532054
}).then(res => res.json());
20542055
// eslint-disable-next-line require-atomic-updates
20552056
layerInfo.xyField = {
@@ -2435,6 +2436,7 @@ export class WebMap extends Observable {
24352436
that.addGeojsonFromUrl(layerInfo, null, layerIndex)
24362437
} else {
24372438
let requestUrl = that.formatUrlWithCredential(url), serviceOptions = {};
2439+
serviceOptions.withCredentials = this.withCredentials;
24382440
if (!this.excludePortalProxyUrl && !CommonUtil.isInTheSameDomain(requestUrl)) {
24392441
serviceOptions.proxy = this.getProxy();
24402442
}

0 commit comments

Comments
 (0)