post插件

来源:互联网 发布:淘宝为啥不卖斐讯 编辑:程序博客网 时间:2024/06/05 08:42

分享牛系列,分享牛专栏,分享牛。在项目开发中,http请求方式是最常见的了。怎么模拟http请求呢?方法有很多种,可以使用httpclient直接模拟请求,也可以使用火狐post插件方式,这个章节主要讲解火狐post插件使用。

首先下载火狐浏览器,直接在下载,附加组件中添加poster即可,附加之后效果如下所示:

 

点击打开即可。看到这个图片表示安装成功了。

下面开始操作:

1.1. get

get方式比较简单,直接在请求中添加?&之类的参数即可。

比如http://127.0.0.1:8080/matrix-deploy/groupuser/get_studio_user_list2?gid=590594

直接在请求中选择get方式即可,或者在参数中添加如下所示:

 

返回的格式如下:

{    "apistatus": 1,    "result": {        "total": 15,        "liveStatus": false,        "onmic": [],        "users": [            {                "birthday": "2013-01-01",                "nickname": "陈陈陈陈_",                "user_type": 1,                "subtag_info": {                    "subtag_name": "房主",                    "subtag_gid": 0,                    "can_show": true                },                "avatar": "18130909",                "id": "109084",                "jointime": "Wed Jun 08 11:44:33 +0800 2016",                "description": "",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 11:44:33 +0800 2016",                "gender": "f",                "role": 4,                "isGag": false            },            {                "birthday": "1985-01-01",                "nickname": "爱扶老奶奶的蜀黍",                "user_type": 1,                "subtag_info": {                    "subtag_name": "管理员",                    "subtag_gid": 0,                    "can_show": false                },                "avatar": "88451951",                "id": "42750",                "jointime": "Wed Jun 08 11:49:49 +0800 2016",                "description": "当芳芳遇到阿德丽娜",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 19:11:21 +0800 2016",                "gender": "m",                "role": 3,                "isGag": false            },            {                "id": "10121",                "birthday": "1990-05-31",                "jointime": "Wed Jun 08 14:23:05 +0800 2016",                "user_type": 1,                "nickname": "NEXI",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 14:23:05 +0800 2016",                "subtag_info": {                    "subtag_name": "管理员",                    "subtag_gid": 0,                    "can_show": false                },                "role": 3,                "gender": "m",                "avatar": "97547862",                "isGag": false            },            {                "id": "40505",                "jointime": "Wed Jun 08 18:27:23 +0800 2016",                "user_type": 1,                "nickname": "�",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 18:27:23 +0800 2016",                "subtag_info": {                    "subtag_name": "管理员",                    "subtag_gid": 0,                    "can_show": false                },                "role": 3,                "gender": "m",                "avatar": "89053902",                "isGag": false            },            {                "id": "40452",                "birthday": "1990-01-01",                "jointime": "Wed Jun 08 16:41:24 +0800 2016",                "user_type": 1,                "nickname": "Ddddd",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 16:41:24 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "f",                "avatar": "89657268",                "isGag": false            },            {                "birthday": "1985-01-01",                "nickname": "自我喔喔喔喔喔喔喔喔喔喔自我喔",                "user_type": 1,                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "avatar": "88792220",                "id": "381531",                "jointime": "Wed Jun 08 18:58:38 +0800 2016",                "description": "",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 18:58:38 +0800 2016",                "gender": "f",                "role": 1,                "isGag": false            },            {                "id": "40561",                "jointime": "Wed Jun 08 18:59:29 +0800 2016",                "user_type": 1,                "nickname": "少吃一口舒服一宿",                "description": "",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 19:08:56 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "m",                "avatar": "90023585",                "isGag": false            },            {                "id": "41340",                "birthday": "1992-01-01",                "jointime": "Wed Jun 08 14:36:01 +0800 2016",                "user_type": 1,                "nickname": "吉吉小王",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 14:36:01 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "f",                "avatar": "89984476",                "isGag": false            },            {                "birthday": "1985-01-01",                "nickname": "v",                "user_type": 1,                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "avatar": "88970314",                "id": "396861",                "jointime": "Wed Jun 08 15:38:13 +0800 2016",                "description": "",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 19:09:34 +0800 2016",                "gender": "m",                "role": 1,                "isGag": false            },            {                "id": "381317",                "birthday": "1969-01-01",                "jointime": "Wed Jun 08 18:45:15 +0800 2016",                "user_type": 1,                "nickname": "2goz",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 19:05:46 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "m",                "avatar": "89985176",                "isGag": false            },            {                "id": "42459",                "jointime": "Wed Jun 08 19:21:20 +0800 2016",                "user_type": 1,                "nickname": "疯子",                "description": "",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 19:21:20 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "m",                "avatar": "89474976",                "isGag": false            },            {                "id": "41436",                "jointime": "Wed Jun 08 19:10:25 +0800 2016",                "user_type": 1,                "nickname": "11",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 19:10:25 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "f",                "isGag": false            },            {                "birthday": "2006-04-05",                "nickname": "冀正",                "user_type": 1,                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "avatar": "89985536",                "id": "398402",                "jointime": "Wed Jun 08 13:27:52 +0800 2016",                "description": "",                "onAir": 0,                "groupuser_props": {                    "isFocus": 2,                    "gag": false,                    "show_mark": true,                    "attention": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 13:27:52 +0800 2016",                "gender": "m",                "role": 1,                "isGag": false            },            {                "id": "41707",                "jointime": "Wed Jun 08 18:46:37 +0800 2016",                "user_type": 1,                "nickname": "8块腹肌",                "description": "",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 18:46:37 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "m",                "avatar": "90023308",                "isGag": false            },            {                "id": "41506",                "jointime": "Wed Jun 08 15:37:06 +0800 2016",                "user_type": 1,                "nickname": "嘉熙",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 15:37:06 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "m",                "isGag": false            },            {                "id": "42624",                "birthday": "1990-01-01",                "jointime": "Wed Jun 08 14:26:10 +0800 2016",                "user_type": 1,                "nickname": "吉吉大王",                "onAir": 0,                "groupuser_props": {                    "show_mark": true,                    "remind": "UnDisturb"                },                "activetime": "Wed Jun 08 14:26:10 +0800 2016",                "subtag_info": {                    "subtag_name": "未分组",                    "subtag_gid": 0,                    "can_show": false                },                "role": 1,                "gender": "f",                "avatar": "90019043",                "isGag": false            }        ],        "queues": []    }}


1.2. post方式

post方式比较费时,我们在选择的时候选择post方式。

 

注意Content-Type一定要选择对,否则会不正确的。

具体值得传递跟get一样?gid=590594

 

具体如下所示:

 

1.3. header添加

很多请求的时候,可能涉及到回话或者其他的东西,需要header支持,在这里就必须要使用添加header方式了,

具体的添加如下:

 

分享牛系列,分享牛专栏,分享牛。 分享牛原创(尊重原创 转载对的时候第一行请注明,转载出处来自分享牛http://blog.csdn.net/qq_30739519) Java架构师交流群 523988350

3 0