locked
What sense in HttpResponseException RRS feed

  • Question

  • User3112162 posted

    Why is it necessary?

    The following 2 methods return the same response.

            [Route("Get1")]
            [HttpGet]
            public HttpResponseMessage Get1()
            {
                var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
                {
                    Content = new StringContent("ABC"),
                    ReasonPhrase = "phrase"
                };
                throw new HttpResponseException(resp);
            }
    
    
    
            [Route("Get3")]
            [HttpGet]
            public HttpResponseMessage Get3()
            {
                var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
                {
                    Content = new StringContent("ABC"),
                    ReasonPhrase = "phrase"
                };
                return resp;
            }
    

    Saturday, March 19, 2016 10:06 PM

Answers

All replies