LoadRunner 函数之 web_add_cookie

发布时间:2017-1-20 17:54:27 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"LoadRunner 函数之 web_add_cookie ",主要涉及到LoadRunner 函数之 web_add_cookie 方面的内容,对于LoadRunner 函数之 web_add_cookie 感兴趣的同学可以参考一下。

运行结果:

附接口测试实现代码:

def cookie(request):    username = request.GET.get("user")    password = request.GET.get("pwd")    cookie_content = request.COOKIES    login_flag = cookie_content.get("is_login")    print login_flag    if login_flag == "True" or (username == "qa" and password == "4399"):        msg = {            "msg": "login success! Welcome~~",            "recive_cookie": cookie_content        }        response = JsonResponse(msg)        response.set_cookie("is_login", True)    else:        msg = {            "msg": "username or password error,please try again!",            "recive_cookie": cookie_content        }        response = JsonResponse(msg)        response.set_cookie("is_login", False)    return response

上一篇:linux/unix 编程手册 fork()函数
下一篇:Mac使用指南

相关文章

相关评论