Skip to content

Commit

Permalink
Merge branch 'main' into v3-params
Browse files Browse the repository at this point in the history
  • Loading branch information
dozheiny authored Mar 5, 2024
2 parents 0ba4911 + 370cc8b commit b70c6b9
Show file tree
Hide file tree
Showing 31 changed files with 8,014 additions and 2,546 deletions.
8 changes: 4 additions & 4 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
<a href="https://goreportcard.com/report/github.com/gofiber/fiber/v3">
<img src="https://img.shields.io/badge/%F0%9F%93%9D%20goreport-A%2B-75C46B?style=flat-square">
</a>
<a href="https://gocover.io/github.com/gofiber/fiber">
<img src="https://img.shields.io/badge/%F0%9F%94%8E%20gocover-97.8%25-75C46B.svg?style=flat-square">
</a>
<a href="https://codecov.io/gh/gofiber/fiber" >
<img alt="Codecov" src="https://img.shields.io/codecov/c/github/gofiber/fiber?token=3Cr92CwaPQ&style=flat-square&logo=codecov&label=codecov">
</a>
<a href="https://github.com/gofiber/fiber/actions?query=workflow%3ASecurity">
<img src="https://img.shields.io/github/actions/workflow/status/gofiber/fiber/security.yml?branch=master&label=%F0%9F%94%91%20gosec&style=flat-square&color=75C46B">
</a>
Expand Down Expand Up @@ -562,7 +562,7 @@ func main() {
}
```

### Recover middleware
### Recover Middleware

📖 [Recover](https://docs.gofiber.io/api/middleware/recover)

Expand Down
8 changes: 4 additions & 4 deletions .github/README_tr.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Bu testler [TechEmpower](https://www.techempower.com/benchmarks/#section=data-r1

## ⚙️ Kurulum

Go'nun `1.20` sürümü ([indir](https://go.dev/dl/)) veya daha yüksek bir sürüm gerekli.
Go'nun yüklü olduğundan emin olun ([indir](https://go.dev/dl/)). `1.20` veya daha yüksek bir sürüme sahip olmanız gerekmektedir.

Bir dizin oluşturup dizinin içinde `go mod init github.com/your/repo` komutunu yazarak projenizi geliştirmeye başlayın ([daha fazla öğren](https://go.dev/blog/using-go-modules)). Ardından Fiber'ı kurmak için [`go get`](https://pkg.go.dev/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them) komutunu çalıştırın:

Expand All @@ -142,7 +142,7 @@ go get -u github.com/gofiber/fiber/v3
- [Statik dosya](https://docs.gofiber.io/api/app#static) sunumu
- Olağanüstü [performans](https://docs.gofiber.io/extra/benchmarks)
- [Düşük bellek](https://docs.gofiber.io/extra/benchmarks) kullanımı
- [API uç noktaları](https://docs.gofiber.io/api/ctx)
- [API uç noktaları (endpoints)](https://docs.gofiber.io/api/ctx)
- Middleware'lar & [Next](https://docs.gofiber.io/api/ctx#next) desteği
- [Hızlı](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) sunucu taraflı programlama
- [Template motorları](https://github.com/gofiber/template)
Expand Down Expand Up @@ -318,7 +318,7 @@ func main() {
Views: pug.New("./views", ".pug"),
})

// Ve şimdi `./views/home.pug` templateni şu şekilde çağırabilirsiniz:
// Ve şimdi `./views/home.pug` template'ini şu şekilde çağırabilirsiniz:
app.Get("/", func(c fiber.Ctx) error {
return c.Render("home", fiber.Map{
"title": "Homepage",
Expand Down Expand Up @@ -582,7 +582,7 @@ Fiber'a dahil edilen middlewareların bir listesi aşağıda verilmiştir.

| Middleware | Açıklama |
| :------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware'ı, bir HTTP Basic auth sağlar. Geçerli kimlik bilgileri için sonraki handlerı ve eksik veya geçersiz kimlik bilgileri için 401 döndürür. |
| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware'ı, bir HTTP Basic authentication sağlar. Geçerli kimlik bilgileri için sonraki handlerı çağırır, eksik veya geçersiz kimlik bilgileri içinse 401 döndürür. |
| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Reponseları durdur ve önbelleğe al. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Fiber için sıkıştırma middleware, varsayılan olarak `deflate`, `gzip` ve `brotli`yi destekler. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Çeşitli seçeneklerle başlangıçlar arası kaynak paylaşımını \(CORS\) etkinleştirin. |
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,17 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- run: go test ./... -v -race -count=1
- name: Install gotestsum
run: go install gotest.tools/gotestsum@v1.11.0

- name: Test
run: gotestsum -f testname -- ./... -race -count=1 -coverprofile=coverage.txt -covermode=atomic

- name: Upload coverage reports to Codecov
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.go-version == '1.22.x' }}
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
slug: gofiber/fiber
14 changes: 7 additions & 7 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,11 +914,11 @@ func (app *App) Hooks() *Hooks {

// Test is used for internal debugging by passing a *http.Request.
// Timeout is optional and defaults to 1s, -1 will disable it completely.
func (app *App) Test(req *http.Request, msTimeout ...int) (*http.Response, error) {
func (app *App) Test(req *http.Request, timeout ...time.Duration) (*http.Response, error) {
// Set timeout
timeout := 1000
if len(msTimeout) > 0 {
timeout = msTimeout[0]
to := 1 * time.Second
if len(timeout) > 0 {
to = timeout[0]
}

// Add Content-Length if not provided with body
Expand Down Expand Up @@ -957,12 +957,12 @@ func (app *App) Test(req *http.Request, msTimeout ...int) (*http.Response, error
}()

// Wait for callback
if timeout >= 0 {
if to >= 0 {
// With timeout
select {
case err = <-channel:
case <-time.After(time.Duration(timeout) * time.Millisecond):
return nil, fmt.Errorf("test: timeout error %vms", timeout)
case <-time.After(to):
return nil, fmt.Errorf("test: timeout error after %s", to)
}
} else {
// Without timeout
Expand Down
2 changes: 1 addition & 1 deletion app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,7 @@ func Test_Test_Timeout(t *testing.T) {
return nil
})

_, err = app.Test(httptest.NewRequest(MethodGet, "/timeout", nil), 20)
_, err = app.Test(httptest.NewRequest(MethodGet, "/timeout", nil), 20*time.Millisecond)
require.Error(t, err, "app.Test(req)")
}

Expand Down
Loading

0 comments on commit b70c6b9

Please sign in to comment.