mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05:00 
			
		
		
		
	Initial setup of test for recorder.go of middleware package
This commit is contained in:
		
							parent
							
								
									60b6c0c03d
								
							
						
					
					
						commit
						53c4797606
					
				
							
								
								
									
										19
									
								
								middleware/recorder_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								middleware/recorder_test.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
package middleware
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/http/httptest"
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestNewResponseRecorder(t *testing.T) {
 | 
			
		||||
	w := httptest.NewRecorder()
 | 
			
		||||
	recordRequest := NewResponseRecorder(w)
 | 
			
		||||
	if !reflect.DeepEqual(recordRequest.ResponseWriter, w) {
 | 
			
		||||
		t.Fatalf("Expected Response writer in the Recording to be same as the one sent")
 | 
			
		||||
	}
 | 
			
		||||
	if recordRequest.status != http.StatusOK {
 | 
			
		||||
		t.Fatalf("Expected recorded status  to be http.StatusOK")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user