Skip to content

Commit

Permalink
fix(parser): body whitespace mangling
Browse files Browse the repository at this point in the history
  • Loading branch information
gorillamoe committed Jul 21, 2024
1 parent aa95e2a commit d20ce2c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d20ce2c

Please sign in to comment.