Skip to content

🎥 Make videos programmatically with React

fix 304 status code

Jonny Burger60c85c1ce09e
diff --git a/packages/it-tests/src/ssr/render-still.test.ts b/packages/it-tests/src/ssr/render-still.test.ts
index 6dea6fbb1e..c3523961c0 100644
--- a/packages/it-tests/src/ssr/render-still.test.ts
+++ b/packages/it-tests/src/ssr/render-still.test.ts
@@ -32,13 +32,14 @@ test("Render video with browser instance open", async () => {
const outPath = path.join(tmpDir, "out.mp4");
- await renderStill({
+ const { buffer } = await renderStill({
output: outPath,
serveUrl: "https://gleaming-wisp-de5d2a.netlify.app/",
composition: reactSvg,
puppeteerInstance,
});
- await puppeteerInstance.close();
+ expect(buffer).toBe(null);
+ await puppeteerInstance.close(false);
});
test("Render still with browser instance not open and legacy webpack config", async () => {
diff --git a/packages/renderer/src/redirect-status-codes.ts b/packages/renderer/src/redirect-status-codes.ts
index 6b698f10de..17b399d8fe 100644
--- a/packages/renderer/src/redirect-status-codes.ts
+++ b/packages/renderer/src/redirect-status-codes.ts
@@ -1 +1,3 @@
-export const redirectStatusCodes = [301, 302, 303, 304, 307, 308];
+// Don't handle 304 status code (Not Modified) as a redirect,
+// since the browser will display the right page.
+export const redirectStatusCodes = [301, 302, 303, 307, 308];
diff --git a/packages/renderer/src/test/render-still.test.ts b/packages/renderer/src/test/render-still.test.ts
index e1e29453c0..59d3d4a602 100644
--- a/packages/renderer/src/test/render-still.test.ts
+++ b/packages/renderer/src/test/render-still.test.ts
@@ -21,22 +21,21 @@ test('Need to pass valid metadata', () => {
).rejects.toThrow(/not be NaN, but is NaN/);
});
-test('Returns buffer in promise result', () => {
- return expect(
- renderStill({
- composition: {
- width: 1000,
- height: 1000,
- fps: 30,
- durationInFrames: 30,
- id: 'react-svg',
- defaultProps: undefined,
- },
- frame: 0,
- serveUrl: 'https://gleaming-wisp-de5d2a.netlify.app/',
- downloadMap: makeDownloadMap(),
- })
- ).resolves.toHaveProperty('buffer');
+test('Returns buffer in promise result', async () => {
+ const {buffer} = await renderStill({
+ composition: {
+ width: 1000,
+ height: 1000,
+ fps: 30,
+ durationInFrames: 30,
+ id: 'react-svg',
+ defaultProps: undefined,
+ },
+ frame: 0,
+ serveUrl: 'https://gleaming-wisp-de5d2a.netlify.app/',
+ downloadMap: makeDownloadMap(),
+ });
+ return expect(buffer?.length).toBeGreaterThan(1000);
});
test('Need to pass valid metadata', () => {