Skip to content

gf/net/gclient/gclient_request.go: panic while post data "@file:" #3748

@FenrirLi

Description

@FenrirLi

Go version

go version go1.20 windows/amd64

GoFrame version

2.2.2

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

// post json with json header
c1 := gclient.New()
c1.SetHeader("Content-Type", "application/json")
a1 := map[string]interface{}{
"name": "@file:",
}
r1, _ := cc.Post(ctx, "http://www.google.com", a1)
fmt.Println(r1.Status)

// post string without json header
c2 := gclient.New()
a2 := "@file:"
r2, _ := cc.Post(ctx, "http://www.google.com", a2)
fmt.Println(r2.Status)

What did you see happen?

1. exception recovered
   1).  github.com/gogf/gf/v2/net/gclient.(*Client).prepareRequest
        D:/develop/gopath/pkg/mod/github.com/gogf/gf/v2@v2.2.2/net/gclient/gclient_request.go:215
   2).  github.com/gogf/gf/v2/net/gclient.(*Client).DoRequest
        D:/develop/gopath/pkg/mod/github.com/gogf/gf/v2@v2.2.2/net/gclient/gclient_request.go:117
   3).  github.com/gogf/gf/v2/net/gclient.(*Client).Post
        D:/develop/gopath/pkg/mod/github.com/gogf/gf/v2@v2.2.2/net/gclient/gclient_request.go:48

What did you expect to see?

image
deal this

Metadata

Metadata

Assignees

Labels

bugIt is confirmed a bug, but don't worry, we'll handle it.doneThis issue is done, which may be release in next version.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions