https://github.com/onface/webmock
https://github.com/onface/webmock
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/onface/webmock
- Owner: onface
- Created: 2018-03-28T15:04:08.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T22:25:43.000Z (over 2 years ago)
- Last Synced: 2025-04-19T16:44:15.099Z (about 1 month ago)
- Language: JavaScript
- Size: 281 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Webmock
```shell
yarn add webmock
``````js
var Webmock = require('webmock')
const { mock , app } = Webmock.express({
port: 1219,
static: __dirname,
url: {
data: {
pass: {},
fail: {msg: 'fail message'}
}
}
})
// mock.writeDoc(__dirname + '/doc.html')
mock.url('/news', {
type: 'get',
data: {
pass: {
'list|10': {
title: '@ctitle'
}
},
empty: {
'list': []
}
}
})mock.url('/login', {
type: 'post',
// JSON schema
req: {
user: {
title: '用户名',
example: 'nimo'
},
password: {
title: '密码',
example: 'abcddefg'
}
}
})
```- `Webmock.express(props)` default props is : [./lib/defaultProps.js](./lib/defaultProps.js)
- `mock.url(settings)` default settings is "./lib/defaultProps.js" url