mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-05-25 00:07:36 +02:00
Replace \\n with \n in X-Message header
This commit is contained in:
parent
d3f71f9d0a
commit
0df8aa9a5d
2 changed files with 12 additions and 1 deletions
server
|
@ -403,6 +403,17 @@ func TestServer_PublishViaGET(t *testing.T) {
|
|||
require.Greater(t, msg.Time, time.Now().Add(23*time.Hour).Unix())
|
||||
}
|
||||
|
||||
func TestServer_PublishMessageInHeaderWithNewlines(t *testing.T) {
|
||||
s := newTestServer(t, newTestConfig(t))
|
||||
|
||||
response := request(t, s, "PUT", "/mytopic", "", map[string]string{
|
||||
"Message": "Line 1\\nLine 2",
|
||||
})
|
||||
msg := toMessage(t, response.Body.String())
|
||||
require.NotEmpty(t, msg.ID)
|
||||
require.Equal(t, "Line 1\nLine 2", msg.Message) // \\n -> \n !
|
||||
}
|
||||
|
||||
func TestServer_PublishFirebase(t *testing.T) {
|
||||
// This is unfortunately not much of a test, since it merely fires the messages towards Firebase,
|
||||
// but cannot re-read them. There is no way from Go to read the messages back, or even get an error back.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue