Hi Stuart,
Does the response header contain an Allow field? a 405 response is supposed to have an Allow field which contains a list of allowed operations on that route. So, I think a 405 should be returned is you're trying to POST to a route which only knows how to GET on that, or something like that.
How we return a 404 when a RecordNotFoundException is encountered is via some exception mapping we add in the Configure method of the REST API plugin:
- Code: Select all
AppHost.Config.MapExceptionToStatusCode.Add(typeof(JiwaApplication.Exceptions.RecordNotFoundException), 404);
AppHost.Config.MapExceptionToStatusCode.Add(typeof(JiwaApplication.Exceptions.LicencingException), 403);
AppHost.Config.MapExceptionToStatusCode.Add(typeof(JiwaApplication.Exceptions.PermissionDeniedException), 403);
AppHost.Config.MapExceptionToStatusCode.Add(typeof(JiwaApplication.Exceptions.ConcurrencyConflictException), 409);
AppHost.Config.MapExceptionToStatusCode.Add(typeof(JiwaApplication.Exceptions.RecordInUseException), 409);
AppHost.Config.MapExceptionToStatusCode.Add(typeof(JiwaFinancials.Jiwa.JiwaODBC.Exceptions.BadLoginException), 401);
If you've not explicitly gone and added your own mappings or modified ours, then it's likely as I said earlier - you've added a GET operation but the client is performing a POST or something other than a GET. Make sure the AppHost.Routes.Add you have for the route correctly passes the right verb - eg:
- Code: Select all
AppHost.Routes.Add(typeof(DebtorAPIKeyDebtorGETRequest), "/Debtors", "GET", "Retrieves a debtor for a API Key authenticated customer.", "");
The "GET" above is the verb .