1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-23 21:43:48 +00:00

Merge pull request #1212 from kiyonlin/client-warning

Make client warning once
This commit is contained in:
kiyon 2021-03-10 15:14:45 +08:00 committed by GitHub
commit f0dac0cdcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -16,3 +16,4 @@ jobs:
uses: actions/checkout@v2
- name: Run Test
run: go test ./... -v -race

View File

@ -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"
)
@ -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)
@ -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()