mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-16 22:16:49 +01:00
10 lines
300 B
TypeScript
10 lines
300 B
TypeScript
import { useMemo } from 'react';
|
|
import type { HttpHeader } from '../lib/models';
|
|
|
|
export function useContentTypeFromHeaders(headers: HttpHeader[] | null): string | null {
|
|
return useMemo(
|
|
() => headers?.find((h) => h.name.toLowerCase() === 'content-type')?.value ?? null,
|
|
[headers],
|
|
);
|
|
}
|