无法使用LoadRunner中的手动关联捕获rest api的响应。显示的错误消息是
错误37 Action.c(37):错误-26377:未找到所请求参数“令牌”的匹配项。在响应中找不到指定的边界,或者匹配的文本长于当前的最大html参数大小6705字节。响应的总长度为6705字节。您可以使用“ web_set_max_html_param_len”来增加最大参数大小。
api响应的格式如下。
{"accessToken":"","expiresIn":3600,"tokenType":"Bearer","refreshToken":"","userId":"","mirrorToken":null,"accessRights":1}
accessToken,refreshToken的值是动态生成的。 我想提取accessToken的值。 我使用的手动相关函数在下面给出
web_set_max_html_param_len("17000");
web_rest("POST: http link to login to the application",
"URL=http link to login to the application ",
"Method=POST",
"EncType=raw",
"Snapshot=t599871.inf",
"Body={\"userName\":\"abc\",\"password\":\"abc\"}",
HEADERS,
"Name=Content-Type", "Value=application/json", ENDHEADER,
"Name=language", "Value=1", ENDHEADER,
"Name=x-app-client-token", "Value=5db89e7472f81a4ea6b7a73f7c6729f1", ENDHEADER,
"Name=X-Client-Id", "Value=backend_web", ENDHEADER,
"Name=X-Client-Secret", "Value=secret", ENDHEADER,
"Name=X-Grant-Type", "Value=password", ENDHEADER,
"Name=X-Scope", "Value=cvan offline_access", ENDHEADER,
"Name=Content-Type", "Value=application/json", ENDHEADER,
LAST);
web_reg_save_param_ex(
"ParamName=tokens",
"LB={\"accessToken\":\"",
"RB=\",\"expiresIn\":3600",
SEARCH_FILTERS,
LAST);