Incorrect Content-Type calling serenity List api/function from third party application

230 Views Asked by At

I tried to call serenity endpoint list function from a third party console application but it is returning System.InvalidOperationException: Incorrect Content-Type error. Do i need to change something on my endpoint? By the way I am able to successfully call the Account/Login function. enter image description here

Below is my API function in serenity endpoint. Even though when running this api in web browser the same error I am getting "System.InvalidOperationException: Incorrect Content-Type"

public ActionResult GetQuotes(IDbConnection connection, ListRequest request) {

var entities = new List<Object>();
var repos = new MyRepository();
var listResponse = repos.List(connection, request);

foreach (var e in listResponse.Entities)
{
    var fields = new List<Object>();
    foreach (var f in e.GetFields())
    {
        fields.Add(e.GetType().GetProperty(f.PropertyName).GetValue(e));
    }
    entities.Add(fields);
}
return Json(entities);

}

1

There are 1 best solutions below

0
On

content type seems like empty. It's must be application/json. check requests from chrome developer tools network tab. you can see your content type there. For serenity, default content type is already application/json, you don't need to do any changes about that.