diff --git a/src-web/components/ConfirmLargeResponse.tsx b/src-web/components/ConfirmLargeResponse.tsx index 973ed6e1..d5ff1ec4 100644 --- a/src-web/components/ConfirmLargeResponse.tsx +++ b/src-web/components/ConfirmLargeResponse.tsx @@ -1,5 +1,5 @@ import type { HttpResponse } from '@yaakapp-internal/models'; -import { useMemo, type ReactNode } from 'react'; +import { type ReactNode, useMemo } from 'react'; import { useSaveResponse } from '../hooks/useSaveResponse'; import { useToggle } from '../hooks/useToggle'; import { isProbablyTextContentType } from '../lib/contentType'; @@ -17,8 +17,7 @@ interface Props { response: HttpResponse; } -const LARGE_TEXT_BYTES = 2 * 1000 * 1000; -const LARGE_OTHER_BYTES = 10 * 1000 * 1000; +const LARGE_BYTES = 2 * 1000 * 1000; export function ConfirmLargeResponse({ children, response }: Props) { const { mutate: saveResponse } = useSaveResponse(response); @@ -29,15 +28,14 @@ export function ConfirmLargeResponse({ children, response }: Props) { }, [response.headers]); const contentLength = response.contentLength ?? 0; - const tooLargeBytes = isProbablyText ? LARGE_TEXT_BYTES : LARGE_OTHER_BYTES; - const isLarge = contentLength > tooLargeBytes; + const isLarge = contentLength > LARGE_BYTES; if (!showLargeResponse && isLarge) { return (

Showing responses over{' '} - + {' '} may impact performance

@@ -49,7 +47,12 @@ export function ConfirmLargeResponse({ children, response }: Props) { Save to File {isProbablyText && ( - getResponseBodyText(response)} /> + getResponseBodyText(response)} + /> )}