Fix tests after #846
Change checkResponse to only expect the configured X-Content-Type-Options header if it doesn't receive a 405 error, which means the handler isn't registered for that method. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>master
							parent
							
								
									cb6fde2f71
								
							
						
					
					
						commit
						98d9b5f589
					
				| 
						 | 
					@ -1248,8 +1248,10 @@ func checkResponse(t *testing.T, msg string, resp *http.Response, expectedStatus
 | 
				
			||||||
		t.FailNow()
 | 
							t.FailNow()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// We expect the headers included in the configuration
 | 
						// We expect the headers included in the configuration, unless the
 | 
				
			||||||
	if !reflect.DeepEqual(resp.Header["X-Content-Type-Options"], []string{"nosniff"}) {
 | 
						// status code is 405 (Method Not Allowed), which means the handler
 | 
				
			||||||
 | 
						// doesn't even get called.
 | 
				
			||||||
 | 
						if resp.StatusCode != 405 && !reflect.DeepEqual(resp.Header["X-Content-Type-Options"], []string{"nosniff"}) {
 | 
				
			||||||
		t.Logf("missing or incorrect header X-Content-Type-Options %s", msg)
 | 
							t.Logf("missing or incorrect header X-Content-Type-Options %s", msg)
 | 
				
			||||||
		maybeDumpResponse(t, resp)
 | 
							maybeDumpResponse(t, resp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue