开发者

Open Rasta InMemoryHost returning 406 error

开发者 https://www.devze.com 2023-03-13 09:40 出处:网络
I\'m trying to write an integration test for an open rasta web service (code bellow) using(var host = new InMemoryHost(new Configuration()))

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号