Log validation errors

This commit is contained in:
Deluan 2016-03-10 09:56:10 -05:00
parent 2437eed586
commit e3dab1392f
2 changed files with 2 additions and 1 deletions

View File

@ -27,6 +27,7 @@ func checkParameters(c ControllerInterface) {
for _, p := range requiredParameters {
if c.GetString(p) == "" {
beego.Warn("Missing required parameter:", p)
abortRequest(c, responses.ERROR_MISSING_PARAMETER)
}
}
@ -42,6 +43,7 @@ func authenticate(c ControllerInterface) {
}
}
if user != beego.AppConfig.String("user") || pass != beego.AppConfig.String("password") {
beego.Warn("Invalid login:", user)
abortRequest(c, responses.ERROR_AUTHENTICATION_FAIL)
}
}

View File

@ -58,7 +58,6 @@ func TestAuthentication(t *testing.T) {
_, w := Get("/rest/ping.view?u=deluan&p=enc:776f726470617373&c=test&v=1.0.0", "TestAuthentication")
Convey("The status should be 'ok'", func() {
v := responses.Subsonic{}
println("------", w.Body.String())
xml.Unmarshal(w.Body.Bytes(), &v)
So(v.Status, ShouldEqual, "ok")
})