Update 'lib.go'

master
Paulo Simão 2021-10-26 17:57:38 +00:00
parent f665dba9a0
commit 196a6f54f2
1 changed files with 2 additions and 1 deletions

3
lib.go
View File

@ -7,6 +7,7 @@ import (
"io" "io"
"net/http" "net/http"
"strings" "strings"
"fmt"
) )
type Cli struct { type Cli struct {
@ -57,7 +58,7 @@ func (c *Cli) Do(method string, strurl string, body []byte) (*http.Response, err
} }
res,err:= c.cli.Do(req) res,err:= c.cli.Do(req)
if err==nil && res.StatusCode >=400{ if err==nil && res.StatusCode >=400{
return nil, errors.New("Http return code - %d: %s",res.StatusCode,res.Status) return nil, errors.New(fmt.Sprintf("Http return code - %d: %s",res.StatusCode,res.Status))
} }
return res,err return res,err
} }