Created
September 1, 2011 15:16
-
-
Save theburningmonk/1186391 to your computer and use it in GitHub Desktop.
A simple wrapper of Nancy.Response that takes in an object to use as the response body
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProtoBufResponse : Response | |
{ | |
public ProtoBufResponse(object body) | |
{ | |
ContentType = "application/x-protobuf"; | |
Contents = stream => ProtoBuf.Serializer.Serialize(stream, body); | |
} | |
public ProtoBufResponse WithStatusCode(HttpStatusCode httpStatusCode) | |
{ | |
StatusCode = httpStatusCode; | |
return this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment