mirror of
https://github.com/elobuff/gortmp
synced 2026-04-23 00:07:26 +08:00
Add HasBody helper to response to determine if a non-response was given (throttled)
This commit is contained in:
+12
@@ -25,6 +25,18 @@ func (r *Response) IsError() bool {
|
||||
return r.Name == "_error"
|
||||
}
|
||||
|
||||
func (r *Response) HasBody() (result bool) {
|
||||
for _, obj := range r.Objects {
|
||||
if obj, ok := obj.(amf.Object); ok == true {
|
||||
if _, ok := obj["body"]; ok == true {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *Response) DecodeBody() (result interface{}, err error) {
|
||||
for _, obj := range r.Objects {
|
||||
if obj, ok := obj.(amf.Object); ok == true {
|
||||
|
||||
Reference in New Issue
Block a user