@applitools/visual-grid-cli-utils 1.21.28 → 1.21.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/view-rendering.js +8 -2
package/package.json
CHANGED
package/src/view-rendering.js
CHANGED
|
@@ -27,12 +27,18 @@ async function main({
|
|
|
27
27
|
const viewRenderingUrl = calculateViewRenderingUrl(renderId, finalAuthToken, accountOverride)
|
|
28
28
|
|
|
29
29
|
if (downloadVhsFolder) {
|
|
30
|
-
|
|
30
|
+
let response = await fetch(viewRenderingUrl)
|
|
31
31
|
if (!response.ok) await throwErrorFromBadStatus(viewRenderingUrl, response)
|
|
32
32
|
const contentType = response.headers.get('content-type')
|
|
33
|
-
if (
|
|
33
|
+
if (contentType.includes('json')) {
|
|
34
|
+
const body = await response.json()
|
|
35
|
+
|
|
36
|
+
response = await fetch(body.vhs)
|
|
37
|
+
if (!response.ok) await throwErrorFromBadStatus(viewRenderingUrl, response)
|
|
38
|
+
} else if (!contentType.includes('x-applitools-vhs')) {
|
|
34
39
|
throw new Error('Content type is not VHS, it is: ' + contentType)
|
|
35
40
|
}
|
|
41
|
+
|
|
36
42
|
const resource = await response.buffer()
|
|
37
43
|
const fname = `${downloadVhsFolder}/${renderId}.vhs`
|
|
38
44
|
fs.writeFileSync(fname, resource)
|