mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-28 12:11:53 +01:00
Support binary responses!
This commit is contained in:
15
src-web/components/responseViewers/ImageViewer.tsx
Normal file
15
src-web/components/responseViewers/ImageViewer.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { convertFileSrc } from '@tauri-apps/api/tauri';
|
||||
import type { HttpResponse } from '../../lib/models';
|
||||
|
||||
interface Props {
|
||||
response: HttpResponse;
|
||||
}
|
||||
|
||||
export function ImageViewer({ response }: Props) {
|
||||
if (response.bodyPath === null) {
|
||||
return <div>Empty response body</div>;
|
||||
}
|
||||
|
||||
const src = convertFileSrc(response.bodyPath);
|
||||
return <img src={src} alt="Response preview" />;
|
||||
}
|
||||
Reference in New Issue
Block a user