diff --git a/src/utils/image.ts b/src/utils/image.ts index cd6efc9..f778a69 100644 --- a/src/utils/image.ts +++ b/src/utils/image.ts @@ -16,14 +16,20 @@ export async function downloadImage(url: string, userAgent: string): Promise { it('accepts valid image MIME types', () => { @@ -72,3 +72,13 @@ describe('bufferToBase64', () => { expect(result).toMatch(/^[A-Za-z0-9+/]+=*$/); }); }); + +describe('normalizeContentType', () => { + it('uses the fallback when Axios exposes a non-string header value', () => { + expect(normalizeContentType(['image/png'])).toBe('image/jpeg'); + }); + + it('removes header parameters from a string content type', () => { + expect(normalizeContentType('image/webp; charset=binary')).toBe('image/webp'); + }); +});