forked from jshiffer/go-xmpp
An IQ can only have a single payload
"An IQ stanza of type "get" or "set" MUST contain exactly one child element, which specifies the semantics of the particular request."
This commit is contained in:
committed by
Mickaël Rémond
parent
d455f29258
commit
af0ae525b8
@@ -78,18 +78,16 @@ func TestParsingDelegationIQ(t *testing.T) {
|
||||
|
||||
// Check that we have extracted the delegation info as IQPayload
|
||||
var node string
|
||||
for _, ext := range iq.Payload {
|
||||
if delegation, ok := ext.(*Delegation); ok {
|
||||
if iq.Payload != nil {
|
||||
if delegation, ok := iq.Payload.(*Delegation); ok {
|
||||
packet := delegation.Forwarded.Stanza
|
||||
forwardedIQ, ok := packet.(IQ)
|
||||
if !ok {
|
||||
t.Errorf("Could not extract packet IQ")
|
||||
return
|
||||
}
|
||||
payload := forwardedIQ.Payload
|
||||
if len(payload) > 0 {
|
||||
pl := payload[0]
|
||||
if pubsub, ok := pl.(*PubSub); ok {
|
||||
if forwardedIQ.Payload != nil {
|
||||
if pubsub, ok := forwardedIQ.Payload.(*PubSub); ok {
|
||||
node = pubsub.Publish.Node
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user