Skip to content

Commit

Permalink
Merge pull request #1212 from kiyonlin/client-warning
Browse files Browse the repository at this point in the history
Make client warning once
  • Loading branch information
kiyonlin committed Mar 10, 2021
2 parents 4e54d48 + ef8f1dd commit f0dac0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ jobs:
uses: actions/checkout@v2
- name: Run Test
run: go test ./... -v -race

10 changes: 6 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import (
"sync"
"time"

"github.com/gofiber/fiber/v2/utils"

"github.com/gofiber/fiber/v2/internal/encoding/json"
"github.com/gofiber/fiber/v2/utils"
"github.com/valyala/fasthttp"
)

Expand Down Expand Up @@ -480,7 +479,7 @@ func (a *Agent) JSON(v interface{}) *Agent {
return a
}

// XML sends a XML request.
// XML sends an XML request.
func (a *Agent) XML(v interface{}) *Agent {
a.req.Header.SetContentType(MIMEApplicationXML)

Expand Down Expand Up @@ -720,10 +719,13 @@ func (a *Agent) Dest(dest []byte) *Agent {
}

/************************** End Agent Setting **************************/
var warnOnce sync.Once

// Bytes returns the status code, bytes body and errors of url.
func (a *Agent) Bytes() (code int, body []byte, errs []error) {
fmt.Println("[Warning] client is still in beta, API might change in the future!")
warnOnce.Do(func() {
fmt.Println("[Warning] client is still in beta, API might change in the future!")
})

defer a.release()

Expand Down

0 comments on commit f0dac0c

Please sign in to comment.