handler.test.ts
This file
Path
src/adapter/aws-lambda/handler.test.ts
27 lines · 1.2 KiB · TypeScript
Last changed by
fix(adapter/aws-lambda): use content-encoding to determine isBase64Encoded (#1295)byunghoo.yubefore adoptiona7dd281
History of this fileTake it
fix(adapter/aws-lambda): use content-encoding to determine isBase64Encoded (#1295)byunghoo.yubefore adoptiona7dd281
line 1why, one step back1import { isContentTypeBinary, isContentEncodingBinary } from './handler'fix(lambda): don't encode text (#1091)Yusuke Wadabefore adoption821a408
lines 2–13why, one step back23describe('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('text/plain')).toBe(false)8 expect(isContentTypeBinary('text/plain; charset=UTF-8')).toBe(false)9 expect(isContentTypeBinary('text/css')).toBe(false)10 expect(isContentTypeBinary('text/javascript')).toBe(false)11 expect(isContentTypeBinary('application/json')).toBe(false)12 expect(isContentTypeBinary('application/ld+json')).toBe(false)13 expect(isContentTypeBinary('application/json; charset=UTF-8')).toBe(false)fix(adapter/aws-lambda): use content-encoding to determine isBase64Encoded (#1295)byunghoo.yubefore adoptiona7dd281
lines 14–25why, one step back14 })15})1617describe('isContentEncodingBinary', () => {18 it('Should determine whether it is compressed', () => {19 expect(isContentEncodingBinary('gzip')).toBe(true)20 expect(isContentEncodingBinary('compress')).toBe(true)21 expect(isContentEncodingBinary('deflate')).toBe(true)22 expect(isContentEncodingBinary('br')).toBe(true)23 expect(isContentEncodingBinary('deflate, gzip')).toBe(true)24 expect(isContentEncodingBinary('')).toBe(false)25 expect(isContentEncodingBinary('unknown')).toBe(false)fix(lambda): don't encode text (#1091)Yusuke Wadabefore adoption821a408
lines 26–27why, one step back26 })27})