mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-15 05:33:29 +01:00
10 lines
310 B
TypeScript
10 lines
310 B
TypeScript
import { useMemo } from 'react';
|
|
import type { HttpResponse } from '../lib/models';
|
|
|
|
export function useResponseContentType(response: HttpResponse | null): string | null {
|
|
return useMemo(
|
|
() => response?.headers.find((h) => h.name.toLowerCase() === 'content-type')?.value ?? null,
|
|
[response],
|
|
);
|
|
}
|