public class TestController : ApiController
{
public HttpResponseMessage Get()
{
return new HttpResponseMessage() { Content = new StringContent("Hello World. Time is: " + DateTime.Now, Encoding.UTF8, "text/plain") };
}
public async Task<HttpResponseMessage> Post(HttpRequestMessage inputMessage)
{
var content = await inputMessage.Content.ReadAsByteArrayAsync();
var response = new HttpResponseMessage { Content = new ByteArrayContent(content) };
return response;
}
public async Task<HttpResponseMessage> Put(HttpRequestMessage inputMessage)
{
var content = await inputMessage.Content.ReadAsStreamAsync();
var response = new HttpResponseMessage { Content = new StreamContent(content) };
return response;
}
}
No comments:
Post a Comment