Don't load response when blocking large responses

This commit is contained in:
Gregory Schier
2025-01-10 06:27:57 -08:00
parent f694456ddc
commit 8b5b66acf0
10 changed files with 197 additions and 122 deletions

View File

@@ -5,7 +5,7 @@ import type {
HttpResponse,
HttpResponseHeader,
} from '@yaakapp-internal/models';
import MimeType from 'whatwg-mimetype';
import { getMimeTypeFromContentType } from './contentType';
export const BODY_TYPE_NONE = null;
export const BODY_TYPE_GRAPHQL = 'graphql';
@@ -61,6 +61,6 @@ export function getCharsetFromContentType(headers: HttpResponseHeader[]): string
const contentType = getContentTypeHeader(headers);
if (contentType == null) return null;
const mimeType = new MimeType(contentType);
const mimeType = getMimeTypeFromContentType(contentType);
return mimeType.parameters.get('charset') ?? null;
}