Spidex
A web requester for Node.js / Browser.
Installation
$ npm install spidex --save
Usage
You just need to get the handler:
var spidex = ;
After v2.0.0, spidex uses new APIs.
And the functions are:
spidex;spidex;spidex;spidex;
opts
can be an Object
that has options follow:
data
: the body data. it may be a querystring or a JSON object.header
: customized request header.charset
: "utf8", "gbk", "big5" or other encodingsiconv-lite
supported. what's more, it supports "binary" now.timeout
: set the totally timeout millionsecond.responseTimeout
: set the response timeout millionsecond.requestTimeout
: set the request timeout millionsecond.
For an example:
spidex;
There's a helper function:
spidex;
And two user-agent
functions:
spidex;spidex;
You can go through test/spidex.js
for further examples.
Hessian V2
After v2.1.0, spidex support for Hessian 2.0 request!
Important: Node.js ONLY!
spidex;
opts
is the same as other functions in spidex, but it will ignore parametersdata
andheader["content-length"]
.
args
is an array of arguments that will fill in the hessian service.
method
is the method name of that hessian service.
For an example, a possible request may like this:
spidex;
License
The MIT License (MIT)
Copyright (c) 2017 ZHU, Kaidi
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.