Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Commit 215dc72

Browse files
authored
Merge pull request #69 from echoface/refactor/rfc7231_content_type
fix: rfc7231 content-type compatible for method GET
2 parents 4c285ef + 5b6cd24 commit 215dc72

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

binding/body.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import (
1414
)
1515

1616
func getBodyCodec(req Request) codec {
17+
// according to rfc7231 https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5
18+
// content type just for payload and payload for Http GET Method are meanless; this
19+
// will cause bad case for http GET method with a muanual added Content-Type Header
20+
if req.GetMethod() == http.MethodGet {
21+
return bodyUnsupport
22+
}
1723
ct := req.GetContentType()
1824
idx := strings.Index(ct, ";")
1925
if idx != -1 {

0 commit comments

Comments
 (0)