2017-06-15 06:15:04 +02:00
|
|
|
### Issue Description
|
2016-06-05 01:42:29 +02:00
|
|
|
|
2024-11-22 21:45:51 +02:00
|
|
|
### Working code to debug
|
2016-06-05 01:42:29 +02:00
|
|
|
|
2024-11-22 21:45:51 +02:00
|
|
|
```go
|
|
|
|
package main
|
2016-06-05 01:42:29 +02:00
|
|
|
|
2024-11-22 21:45:51 +02:00
|
|
|
import (
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
"net/http"
|
|
|
|
"net/http/httptest"
|
|
|
|
"testing"
|
|
|
|
)
|
2016-06-05 01:42:29 +02:00
|
|
|
|
2024-11-22 21:45:51 +02:00
|
|
|
func TestExample(t *testing.T) {
|
|
|
|
e := echo.New()
|
2016-06-05 01:42:29 +02:00
|
|
|
|
2024-11-22 21:45:51 +02:00
|
|
|
e.GET("/", func(c echo.Context) error {
|
|
|
|
return c.String(http.StatusOK, "Hello, World!")
|
|
|
|
})
|
2016-06-05 01:42:29 +02:00
|
|
|
|
2024-11-22 21:45:51 +02:00
|
|
|
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
|
|
|
rec := httptest.NewRecorder()
|
2016-06-05 01:42:29 +02:00
|
|
|
|
2024-11-22 21:45:51 +02:00
|
|
|
e.ServeHTTP(rec, req)
|
2016-06-05 01:42:29 +02:00
|
|
|
|
2024-11-22 21:45:51 +02:00
|
|
|
if rec.Code != http.StatusOK {
|
|
|
|
t.Errorf("got %d, want %d", rec.Code, http.StatusOK)
|
|
|
|
}
|
2016-06-05 01:42:29 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Version/commit
|