| 250 | } |
| 251 | |
| 252 | func Test_App_RegisterNetHTTPHandler(t *testing.T) { |
| 253 | t.Parallel() |
| 254 | |
| 255 | tests := []struct { |
| 256 | name string |
| 257 | register func(app *App, path string, handler any) |
| 258 | method string |
| 259 | expectBody bool |
| 260 | }{ |
| 261 | { |
| 262 | name: "Get", |
| 263 | register: func(app *App, path string, handler any) { |
| 264 | app.Get(path, handler) |
| 265 | }, |
| 266 | method: http.MethodGet, |
| 267 | expectBody: true, |
| 268 | }, |
| 269 | { |
| 270 | name: "Head", |
| 271 | register: func(app *App, path string, handler any) { |
| 272 | app.Head(path, handler) |
| 273 | }, |
| 274 | method: http.MethodHead, |
| 275 | }, |
| 276 | { |
| 277 | name: "Post", |
| 278 | register: func(app *App, path string, handler any) { |
| 279 | app.Post(path, handler) |
| 280 | }, |
| 281 | method: http.MethodPost, |
| 282 | expectBody: true, |
| 283 | }, |
| 284 | { |
| 285 | name: "Put", |
| 286 | register: func(app *App, path string, handler any) { |
| 287 | app.Put(path, handler) |
| 288 | }, |
| 289 | method: http.MethodPut, |
| 290 | expectBody: true, |
| 291 | }, |
| 292 | { |
| 293 | name: "Delete", |
| 294 | register: func(app *App, path string, handler any) { |
| 295 | app.Delete(path, handler) |
| 296 | }, |
| 297 | method: http.MethodDelete, |
| 298 | expectBody: true, |
| 299 | }, |
| 300 | { |
| 301 | name: "Connect", |
| 302 | register: func(app *App, path string, handler any) { |
| 303 | app.Connect(path, handler) |
| 304 | }, |
| 305 | method: http.MethodConnect, |
| 306 | expectBody: true, |
| 307 | }, |
| 308 | { |
| 309 | name: "Options", |