-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hey Half-Shot! I really like the SDK you created. While using it, I encountered what I believe is a bug.
The GenericRequest method of HttpBackend.cs returns a null JToken response if the HTTP status code is anything other than 200. However, as per the client-server specification, the server uses HTTP codes (in addition to the JSON errcode and error) as part of its responses.
For example, trying to login with an invalid password will produce a response body of
{
"errcode": "M_FORBIDDEN"
"error": "Invalid password."
}but it will send it with HTTP 403 in the header. The current method of parsing server responses will strip the useful Matrix error info and return just a null response and a status code.
Consequently, the latter result ["errcode"] check is meaningless, since all messages containing an error will (I believe) return with codes other than 200. This means the only way a MatrixServerError can be thrown is from mangled a JSON body.