Skip to content
Myr

handler.test.ts

This file

Path

src/adapter/lambda-edge/handler.test.ts

36 lines · 1.5 KiB · TypeScript

Last changed by

fix(lambda-edge): Lambda@Edge GET/HEAD body error. (#2351)trkbt10before adoption72f8650

History of this file

Take it

The walk stopped after 200 commits: lines older than 8addfd4 point at it.

fix(lambda-edge): Lambda@Edge GET/HEAD body error. (#2351)trkbt10before adoption72f8650

line 1why, one step back
1import { createBody, isContentTypeBinary } from './handler'

chore: upgrading vitest to v1.0 (#1830)watanybefore adoption8addfd4

lines 2–15why, one step back
2
3describe('isContentTypeBinary', () => {4 it('Should determine whether it is binary', () => {5 expect(isContentTypeBinary('image/png')).toBe(true)6 expect(isContentTypeBinary('font/woff2')).toBe(true)7 expect(isContentTypeBinary('image/svg+xml')).toBe(false)8 expect(isContentTypeBinary('image/svg+xml; charset=UTF-8')).toBe(false)9 expect(isContentTypeBinary('text/plain')).toBe(false)10 expect(isContentTypeBinary('text/plain; charset=UTF-8')).toBe(false)11 expect(isContentTypeBinary('text/css')).toBe(false)12 expect(isContentTypeBinary('text/javascript')).toBe(false)13 expect(isContentTypeBinary('application/json')).toBe(false)14 expect(isContentTypeBinary('application/ld+json')).toBe(false)15 expect(isContentTypeBinary('application/json; charset=UTF-8')).toBe(false)

fix(lambda-edge): Lambda@Edge GET/HEAD body error. (#2351)trkbt10before adoption72f8650

lines 16–34why, one step back
16 })
17})1819describe('createBody', () => {20 it('Should the request be a GET or HEAD, the Request must not include a Body', () => {21 const data = Buffer.from('test')22 const body = {23 action: 'read-only',24 data: data.toString('base64'),25 encoding: 'base64',26 inputTruncated: false,27 }2829 expect(createBody('GET', body)).toEqual(undefined)30 expect(createBody('GET', body)).not.toEqual(data)31 expect(createBody('HEAD', body)).toEqual(undefined)32 expect(createBody('HEAD', body)).not.toEqual(data)33 expect(createBody('POST', body)).toEqual(data)34 expect(createBody('POST', body)).not.toEqual(undefined)

chore: upgrading vitest to v1.0 (#1830)watanybefore adoption8addfd4

lines 35–36why, one step back
35 })
36})