I have a service created with ServiceStack. I recently updated the ServiceStack libraries and now get JSV responses instead of JSON responses.
The query looks something like this:
POST http://localhost/api/rest/poll/create?format=json&PollFormat=1 HTTP/1.1 Host: localhost Connection: keep-alive Content-Length: 160 Accept: *
And the answer looks something like this:
HTTP/1.1 200 OK Cache-Control: private Content-Type: application/json; charset=utf-8 Server: Microsoft-IIS/7.5 X-Powered-By: ServiceStack/3.956 Win32NT/.NET X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Mon, 12 Aug 2013 21:20:33 GMT Content-Length: 437 {Id:1,Question:this is a test,Answers:[{Id:1,Text:yes,Votes:0},{Id:2,Text:no,Votes:0}],IsOpen:1,TotalVotes:0}}
Note that I shortened the JSV in the answer a bit to make it easier to read, in which case the Content-Length would be incorrect for example.
From what I understand, by default ContentType for ServiceStack should be JSON
So why am I returning JSV with ContentType of the application / json?
EDIT:
This is what my dto request looks like:
[Route("/poll/create", Verbs = "POST")] public class PollRequest : IReturn<Object> { public string Question { get; set; } public string Answers { get; set; } public int? PollFormat { get; set; } }
This is what my service looks like:
public class PollService : Service { public object Post(PollRequest request) {
Here's what my poll looks like:
public class Poll { public int Id { get; set; } public string Question { get; set; } public Collection<Answer> Answers { get; set; } public int IsOpen { get; set; } public int TotalVotes { get; set; } public class Answer { public int Id { get; set; } public string Text { get; set; } public int Votes { get; set; } } }