reqman0.9.3 • Public • Published
Reqman is a tool that can quickly help back-end engineers with api testing, as well as a nodejs-based crawler tool.
Before installing, download and install Node.js. Node.js 8.0 or higher is required.
Installation is done using the
npm install command:
$ npm install reqman
// Using Node.js `require()`const Reqman = ;// Using ES6 imports;
- ✔︎ Chained API
- ✔︎ Out of the box
- ✔︎ Crawler, can simulate requests
- ✔︎ Suitable for complex and strong coupling scenarios
- ✔︎ Powerful request library request based on nodejs
Super simple to use
Reqman is designed to be like request and is the easiest way to make http calls. It supports https, to follow redirection by default.
All you have to do is write an anonymous function in the parameters of the
push method that returns a
object and return your request parameters.
Example 1: a single request
//Importing Reqman, remember to capitalize the first letter because Reqman is a class.const Reqman = ;//new Reqman，and then the parameter is passed in a base address.const req =baseUrl: "";//For example, you can use reqman to grab the github address of this project, like this:req;
If you specify the showInfo parameter as false, the results will not be printed to the screen, like this:
Example 2: Chained API
In the chained API, the result of the first request is used as the argument to the second request. like this:
const Reqman = ;const req =baseUrl: "";//Define account passwordconst user =username: "admin"password: "admin"req//Request a login api//Then we update the user's information with the token obtained after login.//just do it.
Example 3: Example of a complete representation of reqman's api and features
'use strict'const req =baseUrl: ""output: "./request-result.txt" //Append the result returned after the request to the specified file path at the same time.specList:type: 'valid' //Parameters: invalid or valid. Define valid or invalid requests.list: 'bob' //Let the request named bob be valid and the rest of the requests invalid. If type is invalid, the opposite is true.;req//Define a request named bob, and the prevElement parameter represents the requestElement object of the previous request.//Define a request named jack, and the prevElement parameter represents the requestElement object of the previous request.
More examples in the projects folder of the project, you can run this command directly:
The MIT License (MIT)
Copyright (c) 2015-present ZhiBing <firstname.lastname@example.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.