mirror of
https://github.com/alibaba/higress.git
synced 2026-04-21 03:57:28 +08:00
fix:fix bug in ext-auth wasm plugin (#1152)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
package wrapper
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/higress-group/proxy-wasm-go-sdk/proxywasm"
|
||||
@@ -81,3 +82,16 @@ func IsBinaryResponseBody() bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func HasRequestBody() bool {
|
||||
contentLengthStr, _ := proxywasm.GetHttpRequestHeader("content-length")
|
||||
if contentLengthStr != "" {
|
||||
contentLength, err := strconv.Atoi(contentLengthStr)
|
||||
if err == nil && contentLength > 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
transferEncodingStr, _ := proxywasm.GetHttpRequestHeader("transfer-encoding")
|
||||
return strings.Contains(transferEncodingStr, "chunked")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user