fix(capacitor): accept 0 as valid status code

This commit is contained in:
Manu Mtz.-Almeida
2018-11-15 17:37:21 +01:00
parent e8e8216f35
commit 685c09df15
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -27,7 +27,7 @@
"test": "stencil test --spec"
},
"devDependencies": {
"@stencil/core": "0.14.0-4",
"@stencil/core": "0.16.0-0",
"@stencil/router": "0.3.0",
"@stencil/sass": "0.1.1",
"@types/highlight.js": "^9.12.3",
+5 -1
View File
@@ -203,7 +203,7 @@ function getSvgContent(doc: Document, url: string, scopedId: string | undefined)
if (!req) {
// we don't already have a request
req = fetch(url, { cache: 'force-cache' }).then(rsp => {
if (rsp.ok) {
if (isStatusValid(rsp.status)) {
return rsp.text();
}
return Promise.resolve(null);
@@ -217,6 +217,10 @@ function getSvgContent(doc: Document, url: string, scopedId: string | undefined)
}
function isStatusValid(status: number) {
return status <= 299;
}
function validateContent(
document: Document,
svgContent: string | null,