diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 9e25941e..47a985d4 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -720,13 +720,10 @@ async fn cmd_format_json(text: &str) -> YaakResult { #[tauri::command] async fn cmd_http_response_body( window: WebviewWindow, - app_handle: AppHandle, plugin_manager: State<'_, PluginManager>, - response_id: &str, + response: HttpResponse, filter: Option<&str>, ) -> YaakResult { - let response = app_handle.db().get_http_response(response_id)?; - let body_path = match response.body_path { None => { return Err(GenericError("Response body path not set".to_string())); @@ -836,7 +833,7 @@ async fn cmd_get_http_authentication_config( AnyModel::Workspace(m) => (m.id, None), m => { return Err(GenericError(format!("Unsupported model to call auth config {m:?}"))); - }, + } }; let environment_chain = diff --git a/src-web/components/ConfirmLargeResponse.tsx b/src-web/components/ConfirmLargeResponse.tsx index 04b4c9c7..11a074c4 100644 --- a/src-web/components/ConfirmLargeResponse.tsx +++ b/src-web/components/ConfirmLargeResponse.tsx @@ -51,7 +51,7 @@ export function ConfirmLargeResponse({ children, response }: Props) { color="secondary" variant="border" size="xs" - text={() => getResponseBodyText({ responseId: response.id, filter: null })} + text={() => getResponseBodyText({ response, filter: null })} /> )} diff --git a/src-web/components/core/Icon.tsx b/src-web/components/core/Icon.tsx index 9320388c..4fb56ff6 100644 --- a/src-web/components/core/Icon.tsx +++ b/src-web/components/core/Icon.tsx @@ -44,8 +44,8 @@ const icons = { copy_check: lucide.CopyCheck, download: lucide.DownloadIcon, ellipsis: lucide.EllipsisIcon, - external_link: lucide.ExternalLinkIcon, expand: lucide.ExpandIcon, + external_link: lucide.ExternalLinkIcon, eye: lucide.EyeIcon, eye_closed: lucide.EyeOffIcon, file_code: lucide.FileCodeIcon, @@ -95,6 +95,7 @@ const icons = { puzzle: lucide.PuzzleIcon, refresh: lucide.RefreshCwIcon, rocket: lucide.RocketIcon, + rows_2: lucide.Rows2Icon, save: lucide.SaveIcon, search: lucide.SearchIcon, send_horizontal: lucide.SendHorizonalIcon, diff --git a/src-web/hooks/useCopyHttpResponse.ts b/src-web/hooks/useCopyHttpResponse.ts index 60be4f8e..f6025f9f 100644 --- a/src-web/hooks/useCopyHttpResponse.ts +++ b/src-web/hooks/useCopyHttpResponse.ts @@ -7,7 +7,7 @@ export function useCopyHttpResponse(response: HttpResponse) { return useFastMutation({ mutationKey: ['copy_http_response', response.id], async mutationFn() { - const body = await getResponseBodyText({ responseId: response.id, filter: null }); + const body = await getResponseBodyText({ response, filter: null }); copyToClipboard(body); }, }); diff --git a/src-web/hooks/useIntrospectGraphQL.ts b/src-web/hooks/useIntrospectGraphQL.ts index e5da81e7..5ab36491 100644 --- a/src-web/hooks/useIntrospectGraphQL.ts +++ b/src-web/hooks/useIntrospectGraphQL.ts @@ -66,7 +66,7 @@ export function useIntrospectGraphQL( return setError(response.error); } - const bodyText = await getResponseBodyText({ responseId: response.id, filter: null }); + const bodyText = await getResponseBodyText({ response, filter: null }); if (response.status < 200 || response.status >= 300) { return setError( `Request failed with status ${response.status}.\nThe response text is:\n\n${bodyText}`, diff --git a/src-web/hooks/useResponseBodyText.ts b/src-web/hooks/useResponseBodyText.ts index 1fe1ba20..613e0caf 100644 --- a/src-web/hooks/useResponseBodyText.ts +++ b/src-web/hooks/useResponseBodyText.ts @@ -17,6 +17,6 @@ export function useResponseBodyText({ response.contentLength, filter ?? '', ], - queryFn: () => getResponseBodyText({ responseId: response.id, filter }), + queryFn: () => getResponseBodyText({ response, filter }), }); } diff --git a/src-web/lib/responseBody.ts b/src-web/lib/responseBody.ts index 7efd7826..164f4a6b 100644 --- a/src-web/lib/responseBody.ts +++ b/src-web/lib/responseBody.ts @@ -4,14 +4,14 @@ import type { ServerSentEvent } from '@yaakapp-internal/sse'; import { invokeCmd } from './tauri'; export async function getResponseBodyText({ - responseId, + response, filter, }: { - responseId: string; + response: HttpResponse; filter: string | null; }): Promise { const result = await invokeCmd('cmd_http_response_body', { - responseId, + response, filter, });