grunt simple rest http utils to verify api
npm install grunt-simple-rest~0.4.5
shell
npm install grunt-simple-rest --save-dev
`
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js
grunt.loadNpmTasks('grunt-simple-rest');
`
`js
grunt.registerTask('default', ['simple_rest']);
`
`js
grunt.registerTask('default', ['simple_rest:simple']);
`
The "simple_rest" task
$3
In your project's Gruntfile, add a section named simple_rest to the data object passed into grunt.initConfig().
`js
grunt.initConfig({
simple_rest: {
simple: {
async: true,
protocol: 'http',
hosts: ['11.22.33.11'],
interrupt: false,
count: 5,
timeout: 3000,
timeGap: 1000,
url: ['/test', '/test2','http://11.111.11.11/test']
}
},
});
`
$3
if the server return json string include {"success":true},the http request return success , other is fail
$3
#### simple.async
Type: boolean
Default value: true
whether http requset parallel
#### simple.protocol
Type: String
Default value: http
http protocol
#### simple.hosts
Type: Array
http hosts list
#### simple.interrupt
Type: boolean
Default value: false
whether exit if have error
#### simple.count
Type: int
Default value: 5
how many count does each http request
#### simple.timeout
Type: int
Default value: 3000 ms
timeout of each http request start
#### simple.timeGap
Type: int
Default value: 1000`