handler.test.ts
This file
Path
src/adapter/aws-lambda/handler.test.ts
29 lines · 1.4 KiB · TypeScript
Last changed by
fix: add missing tail to svg regex (#1788)Elias Brangebefore adoption521db64
History of this fileTake it
The walk stopped after 200 commits: lines older than 48a8729 point at it.
perf(hono-base): use `constructor.name` instead of `instanceof` (#1311)Yusuke Wadabefore adoption48a8729
lines 1–6why, one step back1import { isContentTypeBinary, isContentEncodingBinary } from './handler'23describe('isContentTypeBinary', () => {4 it('Should determine whether it is binary', () => {5 expect(isContentTypeBinary('image/png')).toBe(true)6 expect(isContentTypeBinary('font/woff2')).toBe(true)fix: add missing tail to svg regex (#1788)Elias Brangebefore adoption521db64
lines 7–8why, one step back7 expect(isContentTypeBinary('image/svg+xml')).toBe(false)8 expect(isContentTypeBinary('image/svg+xml; charset=UTF-8')).toBe(false)perf(hono-base): use `constructor.name` instead of `instanceof` (#1311)Yusuke Wadabefore adoption48a8729
lines 9–29why, one step back9 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)16 })17})1819describe('isContentEncodingBinary', () => {20 it('Should determine whether it is compressed', () => {21 expect(isContentEncodingBinary('gzip')).toBe(true)22 expect(isContentEncodingBinary('compress')).toBe(true)23 expect(isContentEncodingBinary('deflate')).toBe(true)24 expect(isContentEncodingBinary('br')).toBe(true)25 expect(isContentEncodingBinary('deflate, gzip')).toBe(true)26 expect(isContentEncodingBinary('')).toBe(false)27 expect(isContentEncodingBinary('unknown')).toBe(false)28 })29})