Open Rasta InMemoryHost returning 406 error
I'm trying to write an integration test for an open rasta web service (code bellow)
using(var host = new InMemoryHost(new Configuration()))
{
var request = new InMemoryRequest {Uri = new Uri("http://localhost/foo"), HttpMethod = "GET"};
request.Ent开发者_运维百科ity.Headers["Accept"] = "application/json";
var response = host.ProcessRequest(request);
}
But keep getting a 406 response.
If I don't specify the json accept header I get a 500 error.
I recently come across this 406 problem. But in my case I could found the problem root cause and then there is a known issue in the Openrasta which is why I was getting 406.
Here is the link for the discussion I had on google group. May be if you dig into the debug information, you will find the route cause of it.
I'm posting this answer thinking that it might be useful for other users who come across same situation.
精彩评论