I'm not getting proper response as per below return value. Currently i'm getting response as namespace of Project as : Feature.SitecoreAPi.Platform.Controller.TestAPIController+HttpActionResult
. Expected response of my code should be Status Code: 200 & OK message 100
(for eg response should be: status code & string message).
This code will work fine, if i use APiController
but here i have to use SitecoreController
public class TestAPIController :SitecoreController
{
[HttpGet]
public IHttpActionResult TestResponse(int id)
{
id = 100;
return new HttpActionResult(HttpStatusCode.OK, "OK message" + id);
}
public class HttpActionResult : IHttpActionResult
{
private readonly string _message;
private readonly HttpStatusCode _statusCode;
public HttpActionResult(HttpStatusCode statusCode, string message)
{
_statusCode = statusCode;
_message = message;
}
public Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
{
HttpResponseMessage response = new HttpResponseMessage(_statusCode)
{
Content = new StringContent(_message)
};
return Task.FromResult(response);
}
}