Return HTTP 500 on Matrix discovery GET if base-url not configured; log entire HTTP request when TRACE enabled
This commit is contained in:
parent
e578f01e5b
commit
25a4b29ffc
5 changed files with 108 additions and 1 deletions
|
@ -907,13 +907,23 @@ func TestServer_PublishUnifiedPushText(t *testing.T) {
|
|||
require.Equal(t, "this is a unifiedpush text message", m.Message)
|
||||
}
|
||||
|
||||
func TestServer_MatrixGateway_Discovery(t *testing.T) {
|
||||
func TestServer_MatrixGateway_Discovery_Success(t *testing.T) {
|
||||
s := newTestServer(t, newTestConfig(t))
|
||||
response := request(t, s, "GET", "/_matrix/push/v1/notify", "", nil)
|
||||
require.Equal(t, 200, response.Code)
|
||||
require.Equal(t, `{"unifiedpush":{"gateway":"matrix"}}`+"\n", response.Body.String())
|
||||
}
|
||||
|
||||
func TestServer_MatrixGateway_Discovery_Failure_Unconfigured(t *testing.T) {
|
||||
c := newTestConfig(t)
|
||||
c.BaseURL = ""
|
||||
s := newTestServer(t, c)
|
||||
response := request(t, s, "GET", "/_matrix/push/v1/notify", "", nil)
|
||||
require.Equal(t, 500, response.Code)
|
||||
err := toHTTPError(t, response.Body.String())
|
||||
require.Equal(t, 50003, err.Code)
|
||||
}
|
||||
|
||||
func TestServer_MatrixGateway_Push_Success(t *testing.T) {
|
||||
s := newTestServer(t, newTestConfig(t))
|
||||
notification := `{"notification":{"devices":[{"pushkey":"http://127.0.0.1:12345/mytopic?up=1"}]}}`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue