Skip to content

Commit c146f0e

Browse files
committed
use capabilities urls, retry with default urls
1 parent 7b47a43 commit c146f0e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ const capabilities = await fetchGetCapabilities(cswTestUrl);
1313
console.log(capabilities);
1414

1515
let describeRecordUrl = capabilities.operations.find(operation=>operation.name==='DescribeRecord')?.getUrls[0];
16-
const describeRecord = await fetchDescribeRecord(describeRecordUrl, capabilities.serviceTypeVersion);
16+
let describeRecord = await fetchDescribeRecord(describeRecordUrl, capabilities.serviceTypeVersion);
17+
if (describeRecord.error && describeRecord.error.indexOf('status') > -1 && describeRecord.error.indexOf('404') > -1) {
18+
describeRecord = await fetchDescribeRecord(cswTestUrl, capabilities.serviceTypeVersion);
19+
}
1720
console.log(describeRecord);
1821

1922
const getRecordsUrl = capabilities.operations.find(operation=>operation.name==='GetRecords')?.getUrls[0];
20-
const getRecords = await fetchGetRecords(getRecordsUrl, capabilities.serviceTypeVersion);
21-
//console.log(getRecords);
23+
const elementSetName = 'brief';
24+
let getRecords = await fetchGetRecords(getRecordsUrl, capabilities.serviceTypeVersion, elementSetName);
25+
if (getRecords.error && getRecords.error.indexOf('status') > -1 && getRecords.error.indexOf('404') > -1) {
26+
getRecords = await fetchGetRecords(cswTestUrl, capabilities.serviceTypeVersion, elementSetName);
27+
}
28+
console.log(getRecords);

0 commit comments

Comments
 (0)