Mock2 moco框架的http协议get方法Mock的实现

首先在Chapter7文件夹下再新建一个startGet.json

startget.json代码如下,因为是get请求,所以要写method关键字,有两个,一个是有参数,一个是无参数的请求。

[{"description":"模拟一个没有参数的get请求","request":{"uri":"/getDemo","method":"get"},"response":{"text":"这是一个没有参数的get请求"}},{"description":"模拟一个带参数的get请求","request":{"uri":"/getwithparam","method":"get","queries":{"name":"huhanshan","age":"18"}},"response":{"text":"这是一个带参数的get请求,胡汉山又回来了"}}
]

启动mock服务器; java -jar ./moco-runner-0.12.0-standalone.jar http -p 8888 -c startupGet.json

然后在浏览器访问:localhost:8888/getDemo      这是一个不带参数的请求

log:

然后也可以访问:http://localhost:8888/getwithparam?name=huhanshan&age=18   这是一个带参数的请求吧

log:

 

转载于:https://www.cnblogs.com/peiminer/p/9636356.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/279386.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Android 干货,强烈推荐

本文主要收集 Android开发中常用的干货技术,现做出目录,此文不断更新中,欢迎关注、点赞、投稿。Android 四大组件与布局1. Activity 使用详解2. Service 使用详解3. Broadcast 使用详解4. ContentProvider 使用详解5. 四大布局 使用详解6. Re…

imessage_如何在所有Apple设备上同步您的iMessage

imessageMessages in iCloud lets you sync your iMessages across all of your Apple devices using your iCloud account. Here’s how to set it up. 通过iCloud中的消息,您可以使用iCloud帐户在所有Apple设备上同步iMessage。 设置方法如下。 Apple announced t…

“.Net 社区大会”(dotnetConf) 2018 Day 1 主题演讲

Miguel de Icaza、Scott Hunter、Mads Torgersen三位大咖给大家带来了 .NET Core ,C# 以及 Xamarin的精彩内容:6月份已经发布了.NET Core 2.1, 大会上Scott Hunter 一开始花了大量的篇幅回顾.NET Core 2.1的发布,社区的参与度已经非常高,.NET…

Windows 2003 NTP 时间服务器设置

需要在局域网中架设一台时间同步服务器,统一各客户端及服务器的系统时间,在网上查找大多是基于Linux下的 确NTP服务器.搜索,实验及总结,写一篇采用Windwos2003自带的W32Time服务用于…

React 深入学习:React 更新队列

path&#xff1a;packages/react-reconciler/src/ReactUpdateQueue.js 更新 export type Update<State> {expirationTime: ExpirationTime, // 到期时间tag: 0 | 1 | 2 | 3, // 更新类型payload: any, // 负载callback: (() > mixed) | null, // 回调函数next: Updat…

长时间曝光计算_如何拍摄好长时间曝光的照片

长时间曝光计算In long exposure photography, you take a picture with a slow shutter speed—generally somewhere between five and sixty seconds—so that any movement in the scene gets blurred. It’s a way to show the passage of time in a single image. Let’s …

思科设备snmp配置。

1、设置IOS设备在IOS的Enable状态下&#xff0c;敲入 config terminal进入全局配置状态 Cdp run启用CDP snmp-server community gsunion ro \\配置本路由器的只读字串为gsunion snmp-server community gsunion rw \\配置本路由器的读写字串为gsunion snmp-server enable trap…

Python——逻辑运算(or,and)

print(0 and 2 > 1) #结果0 print(0 and 2 < 1) #结果0 print(1 and 2 > 1) #结果True print(1 and 2 < 1) #结果False print(2 > 1 and 0) #结果0 print(2 < 1 and 0) #结果False print(2 > 1 and 1) #结果1 print(2 < 1 and 0) #结果False# and 前或…

深度学习入门3

CNN 第一周&#xff1a; title: edge detection example 卷积核在边缘检测中的应用&#xff0c;可解释&#xff0c;卷积核的设计可以找到像素列突变的位置 把人为选择的卷积核参数&#xff0c;改为学习参数&#xff0c;可以学到更多的特征 title: padding n * n图片&#xff0c…

图像大小调整_如何在Windows中调整图像和照片的大小

图像大小调整Most image viewing programs have a built-in feature to help you change the size of images. Here are our favorite image resizing tools for Windows. We’ve picked out a built-in option, a couple of third party apps, and even a browser-based tool.…

Spring Data JPA例子[基于Spring Boot、Mysql]

阅读目录 关于Spring Data关于Spring Data子项目关于Spring Data Jpa例子&#xff0c;Spring Boot Spring Data Jpa运行、测试程序程序源码参考资料关于Spring Data Spring社区的一个顶级工程&#xff0c;主要用于简化数据&#xff08;关系型&非关系型&#xff09;访问&am…

The way of Webpack learning (IV.) -- Packaging CSS(打包css)

一&#xff1a;目录结构 二&#xff1a;webpack.config.js的配置 const path require(path);module.exports {mode:development,entry:{app:./src/app.js},output:{path:path.resolve(__dirname,dist),publicPath:./dist/,//设置引入路径在相对路径filename:[name].bundle.js…

文本文档TXT每行开头结尾加内容批处理代码

文本文档TXT每行开头结尾加内容批处理代码 读A.TXT ,每行开头加&#xff1a;HTMLBodytxt HTMLBodytxt chr(10) aaaaaaaa结尾加&#xff1a;bbbbbbbb处理后的文档写入到B.TXT For /f "delims" %%i in (a.txt) do echo HTMLBodytxt HTMLBodytxt chr(10) aaaaaaaa%%…

windows运行对话框_如何在Windows运行对话框中添加文本快捷方式?

windows运行对话框Windows comes prepackaged with a ton of handy run-dialog shortcuts to help you launch apps and tools right from the run box; is it possible to add in your own custom shortcuts? Windows预包装了许多方便的运行对话框快捷方式&#xff0c;可帮助…

前后台分离--概念相关

js 包管理器:  1、npm  2、bower 包管理器的作用&#xff1a;&#xff08;之前满世界找代码&#xff0c;现在统一地址了。类似于360软件管家&#xff0c;maven仓库。&#xff09;  1、复用别人已经写好的代码。  2、管理包之间的依赖关系。 JS &#xff1a;语言&#…

Zabbix 3.0 安装

Zabbix 3.0 For CentOS6安装 1 概述2 安装MySQL3 安装WEB4 安装Zabbix-Server5配置WEB1概述 对于3.0&#xff0c;官方只提供CentOS7的RPM包&#xff0c;Ubuntu的DEB包&#xff0c;对于CentOS6&#xff0c;默认不提供RPM包&#xff0c;为了照顾到使用CentOS6的兄弟们&#xff0c…

[Hadoop in China 2011] 中兴:NoSQL应用现状及电信业务实践

http://tech.it168.com/a2011/1203/1283/000001283154.shtml 在今天下午进行的NoSQL系统及应用分论坛中&#xff0c;中兴云计算平台研发总工、中兴通讯技术专家委员会专家高洪发表主题演讲“NoSQL技术的电信业务实践”&#xff0c;介绍了NoSQL的发展现状及其在电信业务中的应用…

qmediaplayer获取流类型_Java 流API

流相关的接口和类在java.util.stream包中。AutoCloseable接口来自java.lang包。所有流接口从继承自AutoCloseable接口的BaseStream接口继承。AutoCloseable|--BaseStream|--IntStream|--LongStream|--DoubleStream|--Stream如果流使用集合作为其数据源&#xff0c;并且集合不需…

田刚:庞加莱猜想与几何

&#xff08;作者 田刚&#xff09; 时间&#xff1a;2015年11月1日 地点&#xff1a;北京大学北京国际数学研究中心 主题&#xff1a;未来论坛“理解未来”讲座北大专场&#xff1a;庞加莱猜想与几何 田刚&#xff1a; 非常高兴能够有这个机会来参加未来论坛讲演。我今天要讲的…

进化:从孤胆极客到高效团队_极客学校:学习Windows 7 –远程管理

进化:从孤胆极客到高效团队In this installation of Geek School, we look at how we can administer our machines remotely using Remote Assistance, Remote Desktop, Windows Remote Management also known as WinRM, and PowerShell. 在此Geek School安装中&#xff0c;我…