需求背景.:我在使用 K6 压测API接口的时候,需要先对接口的传参信息进行MD5加密后,在发送到服务器。这样的k6压测js脚本应该如何编写?
提问问题:
- 使用K6压测API接口,如何编写Pre-request Script?可以提供一个K6包含有Pre-request的js压测脚本的例子吗?
- k6有自带的MD5加密签名算法可以引用吗?
需求背景.:我在使用 K6 压测API接口的时候,需要先对接口的传参信息进行MD5加密后,在发送到服务器。这样的k6压测js脚本应该如何编写?
提问问题:
Hey @sunnini,
k6 already supports some cryptographic functions, and MD5 is one of them. However, a pre-request script is a Postman concept, and k6 has its scripting capabilities, as documented in the test lifecycle. Also, there is an introduction to stress testing on our docs.
Disclaimer:
I used Google Translate to understand what you said, so please let me know if the message is lost in translation.