mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-09 07:43:31 +08:00
feat: support websocket protocol
This commit is contained in:
@@ -16,6 +16,7 @@ var Functions = map[string]interface{}{
|
||||
"md5": MD5, // call with one argument
|
||||
"parameterize": loadFromCSV,
|
||||
"P": loadFromCSV,
|
||||
"load_ws_message": loadMessage,
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -282,6 +282,16 @@ func loadFromCSV(path string) []map[string]interface{} {
|
||||
return result
|
||||
}
|
||||
|
||||
func loadMessage(path string) []byte {
|
||||
log.Info().Str("path", path).Msg("load message file")
|
||||
file, err := readFile(path)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("read message file failed")
|
||||
os.Exit(1)
|
||||
}
|
||||
return file
|
||||
}
|
||||
|
||||
func readFile(path string) ([]byte, error) {
|
||||
var err error
|
||||
path, err = filepath.Abs(path)
|
||||
|
||||
Reference in New Issue
Block a user