import { expect } from 'chai'; import { loadFixture, testIntegration } from './test-utils.js'; import netlifyAdapter from '../../dist/index.js'; describe('Base64 Responses', () => { /** @type {import('../../../astro/test/test-utils').Fixture} */ let fixture; before(async () => { fixture = await loadFixture({ root: new URL('./fixtures/base64-response/', import.meta.url).toString(), output: 'server', adapter: netlifyAdapter({ dist: new URL('./fixtures/base64-response/dist/', import.meta.url), binaryMediaTypes: ['font/otf'], }), site: `http://example.com`, integrations: [testIntegration()], }); await fixture.build(); }); it('Can return base64 encoded strings', async () => { const entryURL = new URL( './fixtures/base64-response/.netlify/functions-internal/entry.mjs', import.meta.url ); const { handler } = await import(entryURL); const resp = await handler({ httpMethod: 'GET', headers: {}, rawUrl: 'http://example.com/image', body: '{}', isBase64Encoded: false, }); expect(resp.statusCode, 'successful response').to.equal(200); expect(resp.isBase64Encoded, 'includes isBase64Encoded flag').to.be.true; const buffer = Buffer.from(resp.body, 'base64'); expect(buffer.toString(), 'decoded base64 string matches').to.equal('base64 test string'); }); it('Can define custom binaryMediaTypes', async () => { const entryURL = new URL( './fixtures/base64-response/.netlify/functions-internal/entry.mjs', import.meta.url ); const { handler } = await import(entryURL); const resp = await handler({ httpMethod: 'GET', headers: {}, rawUrl: 'http://example.com/font', body: '{}', isBase64Encoded: false, }); expect(resp.statusCode, 'successful response').to.equal(200); expect(resp.isBase64Encoded, 'includes isBase64Encoded flag').to.be.true; const buffer = Buffer.from(resp.body, 'base64'); expect(buffer.toString(), 'decoded base64 string matches').to.equal('base64 test font'); }); }); 10-and-catalogs'>chore/pnpm-10-and-catalogs Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/packages/renderers/renderer-svelte/server.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2021-10-14Expose Vue component names for devtools (#1512)Gravatar Levi 3-3/+10
2021-10-14Fix type error in blog-multiple-authors example (#1553)Gravatar Yoshiaki Togami 4-4/+9
2021-10-14Add Vercel sponsorship logo (#1555)Gravatar Drew Powers 8-48/+60
2021-10-14Include pnpm example on "Installation" page (#1554)Gravatar Henrique Borges 1-0/+5
2021-10-14Added descriptions to docs pages (#1550)Gravatar AsyncBanana 22-8/+28
2021-10-14Only run `.github/workflows/stats.yml` locally, not on forks (#1549)Gravatar Caleb Jasik 1-0/+1
2021-10-14[ci] collect statsGravatar FredKSchott 1-0/+1
2021-10-13Add Community Themes and separate Featured Theme (#1543)Gravatar Mark Teekman 2-8/+30
2021-10-13Change publish date el to be more accessible (#1522)Gravatar AsyncBanana 2-2/+2
2021-10-13[ci] yarn formatGravatar matthewp 1-1/+1
2021-10-13docs: unify concepts in Spanish version (#1545)Gravatar Jorge del Casar 6-11/+11
2021-10-13[ci] yarn formatGravatar matthewp 1-1/+1