用shell编写的几个支持http接口测试的工具方法
来源:互联网 发布:电脑内部录音软件 编辑:程序博客网 时间:2024/05/31 04:03
后续还会更新。
#!/bin/sh#author joel#URLencode方法url_encode(){ echo "$1" | tr -d '\n' | xxd -plain | sed 's/\(..\)/%\1/g' | tr -d '\n' return 0}#URLdecode方法url_decode(){ printf $(echo -n $t | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g') return 0}#parse json dataparse_json(){ json=`echo $1 | sed 's/\"//g'`; #remove quotation mark echo $json | sed 's/.*'$2':\([^,}]*\).*/\1/' return 0}#parse uri parameterparse_uri_paras(){ echo $1 | sed 's/.*'$2'=\([[:alnum:]]*\).*/\1/' return 0}# get the redirect addressrequest_redirect_url(){ echo `curl -i "$1" 2>/dev/null | sed -n 's/^Location://p'` return 0}# sent http get http_get(){ get_data=`curl -X GET "$1" 2>/dev/null` if [ "$get_data" = "" ]; then #出错了 echo "出错了,试试:curl -X GET \"$1\"" exit 1 else echo $get_data return 0 fi}# send http posthttp_post(){ post_data=`curl -X POST -d "$1" $2 2>/dev/null` if [ "$post_data" = "" ]; then #出错了 echo "出错了,试试:curl -X POST \"$1\" \"$2\"" exit 1 else echo $post_data return 0 fi}
阅读全文
0 0
- 用shell编写的几个支持http接口测试的工具方法
- Java编写的接口测试工具
- 爱测未来开发-巧用模板引擎编写基于参数配置文件的HTTP接口测试工具
- 编写测试用例的几个要素
- 浅谈HTTP接口性能测试脚本的编写
- 基于ubuntu编写的几个shell脚本
- Linux-编写Shell的几个技巧
- Shell脚本编写的几个小知识点
- 编写一个支持重定向的shell
- 编写接口测试的测试用例体会
- 编写接口测试的测试用例体会
- 编写接口测试的测试用例体会
- 好用的接口测试工具-soapui
- Http接口测试工具HttpTestTool
- 在线HTTP接口测试工具
- http接口测试工具postman
- HTTP接口测试工具-CDSpace
- HTTP接口测试工具-CDSpace
- node js 解决跨域问题 ---vue axios 访问本地服务器端口报错问题
- 程序员闲下来干什么?
- python实现递归的例子
- 基于神经网络的实体识别和关系抽取联合学习
- 笔记-201801108-1
- 用shell编写的几个支持http接口测试的工具方法
- java.lang.IllegalArgumentException: Does not contain a valid host:port authority: ignorethis
- Ubuntu16.04下安装MySQL 5.7.20
- (转)函数调用栈 剖析+图解
- ubuntu17.10解决fcitx输入法不能在idea或者其他java软件环境下使用中文的问题
- 分布式系统的一致性探讨
- nginx配置反向代理
- POJ
- ubuntu安装pip+python27+ipython+scrapy+zlib-及遇到的各种问题解决