mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 15:10:50 +08:00 
			
		
		
		
	Fix incorrect response StatusCode for middleware added before Ocelot (#380)
This commit is contained in:
		
				
					committed by
					
						
						Tom Pallister
					
				
			
			
				
	
			
			
			
						parent
						
							3bde18f6f8
						
					
				
				
					commit
					095406bd45
				
			@@ -59,12 +59,8 @@ namespace Ocelot.Responder
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void SetErrorResponseOnContext(HttpContext context, int statusCode)
 | 
					        public void SetErrorResponseOnContext(HttpContext context, int statusCode)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            context.Response.OnStarting(x =>
 | 
					            context.Response.StatusCode = statusCode;
 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                context.Response.StatusCode = statusCode;
 | 
					 | 
				
			||||||
                return Task.CompletedTask;
 | 
					 | 
				
			||||||
            }, context);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static void AddHeaderIfDoesntExist(HttpContext context, Header httpResponseHeader)
 | 
					        private static void AddHeaderIfDoesntExist(HttpContext context, Header httpResponseHeader)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user