0

I'm still not clear when do you return a class and when a HttpResponseMessage like HttpStatusCode.OK on an WebAPI controller.

Is it when you don't expect nothing in return, that's when you return a HttpResponseMessage?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
SF Developer
  • 5,244
  • 14
  • 60
  • 106
  • Good point, it's a duplicate. Shall I delete mine? – SF Developer Oct 13 '13 at 18:58
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Oct 13 '13 at 21:36

1 Answers1

1

This is totally depends on what you wish to return.
The HttpResponseMessage should contain both, even when you return a class, you better set the HttpStatusCode.OK so the receiver would first check if its OK, and only then take the content and serialize it to class or what ever you have done with it.

ilansch
  • 4,784
  • 7
  • 47
  • 96