A class that represents the response to an HTTP request.
Inheritance: BasicHttpResponse
        public void ProcessRequest_WithStumpsHttpResponse_PopulatesOrigin()
        {
            var handler = new FallbackResponseHandler(FallbackResponse.Http503ServiceUnavailable);

            var hitCount = 0;
            handler.ContextProcessed += (o, e) => hitCount++;

            var response = new StumpsHttpResponse();
            var context = new MockHttpContext(null, response);

            handler.ProcessRequest(context);
            Assert.AreEqual(response.Origin, HttpResponseOrigin.ServiceUnavailable);
        }
Example #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="T:Stumps.Http.StumpsHttpContext"/> class.
        /// </summary>
        /// <param name="context">The <see cref="T:System.Net.HttpListenerContext"/> used to initialize the instance.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="context"/> is <c>null</c>.</exception>
        public StumpsHttpContext(HttpListenerContext context)
        {

            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            this.UniqueIdentifier = Guid.NewGuid();
            this.ReceivedDate = DateTime.Now;

            _context = context;

            // Initialize the HTTP request for the context
            _request = new StumpsHttpRequest();
            _request.InitializeInstance(context.Request);

            // Initialize the HTTP response for the context
            _response = new StumpsHttpResponse();

        }
Example #3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="StumpsHttpContext"/> class.
 /// </summary>
 public StumpsHttpContext()
 {
     // Initialize the HTTP response for the context
     _response = new StumpsHttpResponse();
 }