-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve http mock #101
Labels
Comments
不是很理解这个约定。 const apiPrefix = 'oni';
module.exports = {
[`GET ${apiPrefix}/user/logout`] (req, res) {
res.status(200).end()
},
} 然后,url地址应该请求什么? |
这个还没做,你需要在 |
自己加了个加载 // .roadhogrc.mock.js
const fs = require('fs');
const path = require('path');
const mockAPI = {};
fs.readdirSync(path.join(__dirname, 'mock')).forEach(file => {
const isFile = fs.statSync(path.join(__dirname, 'mock', file)).isFile();
if (isFile) {
const extname = path.extname(file);
switch (extname) {
case '.js':
// eslint-disable-next-line
Object.assign(mockAPI, require(`./mock/${file}`));
break;
case '.json':
Object.assign(mockAPI, {
[file]: file,
});
break;
default:
}
}
});
module.exports = mockAPI; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
./mock/**/*.js
The text was updated successfully, but these errors were encountered: