mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 09:55:28 +08:00 
			
		
		
		
	Change to fix issue not setting content type header
This commit is contained in:
		@@ -117,6 +117,35 @@
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void Should_map_content_type_header()
 | 
			
		||||
        {
 | 
			
		||||
            this.Given(_ => GivenTheInputRequestHasContent("This is my content"))
 | 
			
		||||
                .And(_ => GivenTheContentTypeIs("application/json"))
 | 
			
		||||
                .And(_ => GivenTheInputRequestHasMethod("GET"))
 | 
			
		||||
                .And(_ => GivenTheInputRequestHasAValidUri())
 | 
			
		||||
                .When(_ => WhenMapped())
 | 
			
		||||
                .Then(_ => ThenNoErrorIsReturned())
 | 
			
		||||
                .And(_ => ThenTheMappedRequestHasContentTypeHeader("application/json"))
 | 
			
		||||
                .And(_ => ThenTheMappedRequestHasContentSize("This is my content".Length))
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GivenTheContentTypeIs(string contentType)
 | 
			
		||||
        {
 | 
			
		||||
            _inputRequest.ContentType = contentType;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ThenTheMappedRequestHasContentTypeHeader(string expected)
 | 
			
		||||
        {
 | 
			
		||||
            _mappedRequest.Data.Content.Headers.ContentType.MediaType.ShouldBe(expected);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ThenTheMappedRequestHasContentSize(long expected)
 | 
			
		||||
        {
 | 
			
		||||
            _mappedRequest.Data.Content.Headers.ContentLength.ShouldBe(expected);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void Should_handle_no_content()
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user