-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(GODT-1617): correctly parse headers with space lines.
- Loading branch information
1 parent
1f23fac
commit 6411b23
Showing
6 changed files
with
109 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,3 +159,46 @@ From me`, string(section.Part(2, 1).Literal())) | |
This part is also embedded`, string(section.Part(2, 2).Literal())) | ||
} | ||
|
||
func TestParseSpaceLineHeaderMessage(t *testing.T) { | ||
const literal = `Content-Type: text/plain | ||
Date: Thu, 03 Sep 2020 16:47:43 +0000 (UTC) | ||
Subject: Sometimes | ||
header fields can be long and contain space line :shrug: | ||
From: Dad <[email protected]> | ||
To: Ships <[email protected]> | ||
Why does the Norway navy have bar codes on the side of their ships? | ||
So when they com back to port they can | ||
Scandinavian | ||
` | ||
|
||
section, err := Parse([]byte(literal)) | ||
require.NoError(t, err) | ||
|
||
assert.Equal(t, literal, string(section.Literal())) | ||
|
||
assert.Equal(t, `Content-Type: text/plain | ||
Date: Thu, 03 Sep 2020 16:47:43 +0000 (UTC) | ||
Subject: Sometimes | ||
header fields can be long and contain space line :shrug: | ||
From: Dad <[email protected]> | ||
To: Ships <[email protected]> | ||
`, | ||
string(section.Header()), | ||
) | ||
|
||
assert.Equal(t, `Why does the Norway navy have bar codes on the side of their ships? | ||
So when they com back to port they can | ||
Scandinavian | ||
`, | ||
string(section.Body()), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Content-Type: text/plain | ||
Date: Thu, 03 Sep 2020 16:47:43 +0000 (UTC) | ||
Subject: Sometimes | ||
|
||
header fields can be long and contain space line :shrug: | ||
From: Dad <[email protected]> | ||
To: Ships <[email protected]> | ||
|
||
Why does the Norway navy have bar codes on the side of their ships? | ||
|
||
So when they com back to port they can | ||
|
||
Scandinavian | ||
|