代码拉取完成,页面将自动刷新
package testutils
import (
"fmt"
"strings"
"gitee.com/kennyzw/gosip/log"
"gitee.com/kennyzw/gosip/sip"
"gitee.com/kennyzw/gosip/sip/parser"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func Message(rawMsg []string) sip.Message {
msg, err := parser.ParseMessage([]byte(strings.Join(rawMsg, "\r\n")), log.NewDefaultLogrusLogger())
Expect(err).ToNot(HaveOccurred())
return msg
}
func Request(rawMsg []string) sip.Request {
msg := Message(rawMsg)
switch msg := msg.(type) {
case sip.Request:
return msg
case sip.Response:
Fail(fmt.Sprintf("%s is not a request", msg.Short()))
default:
Fail(fmt.Sprintf("%s is not a request", msg.Short()))
}
return nil
}
func Response(rawMsg []string) sip.Response {
msg := Message(rawMsg)
switch msg := msg.(type) {
case sip.Response:
return msg
case sip.Request:
Fail(fmt.Sprintf("%s is not a response", msg.Short()))
default:
Fail(fmt.Sprintf("%s is not a response", msg.Short()))
}
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。