fix #1388
This commit is contained in:
		
							parent
							
								
									4ba50e5df5
								
							
						
					
					
						commit
						912abe3272
					
				| @ -353,7 +353,7 @@ func (p *ControllerRegister) Handler(pattern string, h http.Handler, options ... | |||||||
| 	route.handler = h | 	route.handler = h | ||||||
| 	if len(options) > 0 { | 	if len(options) > 0 { | ||||||
| 		if _, ok := options[0].(bool); ok { | 		if _, ok := options[0].(bool); ok { | ||||||
| 			pattern = path.Join(pattern, "?:all") | 			pattern = path.Join(pattern, "?:all(.*)") | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	for _, m := range HTTPMETHOD { | 	for _, m := range HTTPMETHOD { | ||||||
|  | |||||||
| @ -333,6 +333,18 @@ func TestRouterHandler(t *testing.T) { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func TestRouterHandlerAll(t *testing.T) { | ||||||
|  | 	r, _ := http.NewRequest("POST", "/sayhi/a/b/c", nil) | ||||||
|  | 	w := httptest.NewRecorder() | ||||||
|  | 
 | ||||||
|  | 	handler := NewControllerRegister() | ||||||
|  | 	handler.Handler("/sayhi", http.HandlerFunc(sayhello), true) | ||||||
|  | 	handler.ServeHTTP(w, r) | ||||||
|  | 	if w.Body.String() != "sayhello" { | ||||||
|  | 		t.Errorf("TestRouterHandler can't run") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // | // | ||||||
| // Benchmarks NewApp: | // Benchmarks NewApp: | ||||||
| // | // | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user