Store encoding in cache database

This commit is contained in:
Philipp Heckel 2022-01-17 19:14:51 -05:00
parent 7e817f408c
commit df6611e8de
2 changed files with 54 additions and 9 deletions

View file

@ -625,7 +625,7 @@ func TestServer_UnifiedPushDiscovery(t *testing.T) {
require.Equal(t, `{"unifiedpush":{"version":1}}`+"\n", response.Body.String())
}
func TestServer_PublishUnifiedPushBinary(t *testing.T) {
func TestServer_PublishUnifiedPushBinary_AndPoll(t *testing.T) {
b := make([]byte, 12) // Max length
_, err := rand.Read(b)
require.Nil(t, err)
@ -639,6 +639,14 @@ func TestServer_PublishUnifiedPushBinary(t *testing.T) {
b2, err := base64.StdEncoding.DecodeString(m.Message)
require.Nil(t, err)
require.Equal(t, b, b2)
response = request(t, s, "GET", "/mytopic/json?poll=1", string(b), nil)
require.Equal(t, 200, response.Code)
m = toMessage(t, response.Body.String())
require.Equal(t, "base64", m.Encoding)
b2, err = base64.StdEncoding.DecodeString(m.Message)
require.Nil(t, err)
require.Equal(t, b, b2)
}
func TestServer_PublishUnifiedPushBinary_Truncated(t *testing.T) {