From e57d73267e18d33678c0aa17f15bbfcf389a5a81 Mon Sep 17 00:00:00 2001 From: Weslley Almeida Date: Fri, 7 Jun 2019 09:57:56 -0300 Subject: [PATCH] Fix no header requests --- lib/cwmp.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cwmp.ts b/lib/cwmp.ts index 4a1bf5d..fb94b56 100644 --- a/lib/cwmp.ts +++ b/lib/cwmp.ts @@ -1231,7 +1231,8 @@ async function listenerAsync( } if (!charset) { - const e = parseXmlDeclaration(body).find(s => s.localName === "encoding"); + const parse = parseXmlDeclaration(body); + const e = parse ? parse.find(s => s.localName === "encoding") : null; charset = e ? e.value : "utf8"; }