From cc04d6f98205065d3d8a50627a7c3f7268309385 Mon Sep 17 00:00:00 2001 From: Laszlo Sari Date: Mon, 8 Jun 2020 21:27:10 +0200 Subject: [PATCH] removed whitespaces from Content-Type header in LoadURL() --- load.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/load.go b/load.go index ab95325..c83c2da 100644 --- a/load.go +++ b/load.go @@ -132,11 +132,12 @@ func (l *Loader) LoadURL(url string) (*Properties, error) { } ct := resp.Header.Get("Content-Type") + ct = strings.Join(strings.Fields(ct), "") var enc Encoding switch strings.ToLower(ct) { - case "text/plain", "text/plain; charset=iso-8859-1", "text/plain; charset=latin1": + case "text/plain", "text/plain;charset=iso-8859-1", "text/plain;charset=latin1": enc = ISO_8859_1 - case "", "text/plain; charset=utf-8": + case "", "text/plain;charset=utf-8": enc = UTF8 default: return nil, fmt.Errorf("properties: invalid content type %s", ct)