I have an EmbedIO API and want to return an HttpException, like for example "401 - unauthorized". If a username is not found upon logging in, I throw an HttpException inside my API endpoint method, like the following:
// return 401
throw HttpException.Unauthorized(message="user name does not exist", data=myData);
But it seems like EmbedIO ignores the data, which I thought would be included in my response content. But instead I get a "standard" response, generated by the server that only uses my message and says:
401 - Unauthorized
401 - Unauthorized
Exception type: EmbedIO.HttpException
Message: user name does not exist
If this error is completely unexpected to you, and you think you should not seeing this page, please contact the server administrator, informing them of the time this error occurred and the action(s) you performed that resulted in this error.
Does anybody know how to return a response with custom content that is specified throught the "data" parameter? Like for example
{ "userName" : "testUser", "userNameExist" : "false", "attempt" : 5 }