mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-30 22:22:02 +02:00
Support non-utf8 charsets
This commit is contained in:
@@ -46,3 +46,8 @@ export function modelsEq(a: Model, b: Model) {
|
||||
export function getContentTypeHeader(headers: HttpResponseHeader[]): string | null {
|
||||
return headers.find((h) => h.name.toLowerCase() === 'content-type')?.value ?? null;
|
||||
}
|
||||
|
||||
export function getCharsetFromContentType(headers: HttpResponseHeader[]): string | null {
|
||||
const contentType = getContentTypeHeader(headers);
|
||||
return contentType?.match(/charset=([^ ;]+)/)?.[1] ?? null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user