From d20ce2c3b4ba0af3cf6ef0c9be16b698ead8b7b7 Mon Sep 17 00:00:00 2001 From: Marco Kellershoff Date: Sun, 21 Jul 2024 18:59:23 +0200 Subject: [PATCH] fix(parser): body whitespace mangling --- internal/parser/parser.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 0621240..3616be9 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -42,8 +42,7 @@ func parseSection(section string, document *Document) Section { Body: "", } lines := strings.Split(section, "\n") - for _, line := range lines { - line = strings.TrimSpace(line) + for lineidx, line := range lines { if line == "" { if !in_request && !in_body { in_header = false @@ -75,6 +74,9 @@ func parseSection(section string, document *Document) Section { } } else if in_body { parsedSection.Body += line + if lineidx != len(lines)-1 { + parsedSection.Body += "\n" + } } } return parsedSection