We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if URL address is down, call panics on v2.15.2, on v2.14.0 it works ok.
panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x104d74e5c] goroutine 1 [running]: github.com/go-resty/resty/v2.(*Request).Execute.func1() /Users/deferbot/go/pkg/mod/github.com/go-resty/resty/[email protected]/request.go:995 +0x134 panic({0x104e561c0?, 0x105086270?}) /opt/homebrew/Cellar/go/1.23.1/libexec/src/runtime/panic.go:785 +0x124 github.com/go-resty/resty/v2.responseLogger(0x14000164288, 0x14000096050) /Users/deferbot/go/pkg/mod/github.com/go-resty/resty/[email protected]/middleware.go:378 +0x29c github.com/go-resty/resty/v2.(*Client).execute(0x14000164288, 0x1400018a000) /Users/deferbot/go/pkg/mod/github.com/go-resty/resty/[email protected]/client.go:1247 +0x258 github.com/go-resty/resty/v2.(*Request).Execute(0x1400018a000, {0x104d7df60?, 0x104d7e509?}, {0x104d7f161, 0x8}) /Users/deferbot/go/pkg/mod/github.com/go-resty/resty/[email protected]/request.go:1019 +0x520 github.com/go-resty/resty/v2.(*Request).Get(...) /Users/deferbot/go/pkg/mod/github.com/go-resty/resty/[email protected]/request.go:935 main.main() /Users/deferbot/develop/tests/resty-error/main.go:31 +0x464
2024/09/26 12:01:13 Get "http://64.5.122.227:3040/7185551212": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
package main import ( "context" "log" "time" "github.com/go-resty/resty/v2" ) type phoneData struct { T string `json:"phone,omitempty"` P int `json:"provider,omitempty"` } func main() { ctx, cancel := context.WithTimeout(context.Background(), time.Second*6) defer cancel() c := resty.New(). SetDebug(true). SetTimeout(3 * time.Second). SetBaseURL("http://64.5.122.227:3040"). SetHeaders(map[string]string{ "Content-Type": "application/json; charset=utf-8", "User-Agent": "utd.store", }) body := phoneData{} resp, err := c.R().SetContext(ctx).SetResult(&body).SetPathParam("phone", "7185551212").Get("/{phone}") if err != nil { log.Fatal(err) } if resp.IsError() { log.Fatal(resp.Error()) } log.Printf("body: %+v\n", body) }
The text was updated successfully, but these errors were encountered:
@deferbot Thanks for reaching out. Coincidently, @matlockx submitted a PR to address this nil panic with #872
I will release v2.15.3 once I get home. Thanks.
Sorry, something went wrong.
@deferbot I was able to make the release prep work on the browser. Now, v2.15.3 has been released.
Great, it is working now with v2.15.3.
Thanks.
Successfully merging a pull request may close this issue.
if URL address is down, call panics on v2.15.2, on v2.14.0 it works ok.
with v2.15.2:
with v2.14.0:
2024/09/26 12:01:13 Get "http://64.5.122.227:3040/7185551212": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
This is the sample code:
The text was updated successfully, but these errors were encountered: