前端开源库-node-http

  • G6_300572
    了解作者
  • 3KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-23 01:24
    上传日期
前端开源库-node-http节点http,节点http。
前端开源库-node-http.zip
  • node-http-master
  • test
  • index.js
    362B
  • lib
  • node-http.js
    3.7KB
  • README.md
    1.1KB
  • package.json
    580B
  • index.js
    45B
内容介绍
node-http ========== Unify http interface in Node. ## Installation ```shell npm install node-http ``` ## API ```javascript var NodeHttp = require('node-http'); var nodeHttp = new Http; ``` #### .url(String address) #### .header(String name, String value) #### .data(Mix data) #### .method(String name) #### .on(String event, Function callback) #### .off(String event, Function callback) #### .complete(Function callback) #### .success(Function callback) #### .fail(Function callback) #### .GET(String address, [Function onComplete], [Function onError]) #### .POST(String address, Mix data, [Function onComplete], [Function onError]) #### .request(Object options, [Function onComplete], [Function onError]) ## Events #### 'complete' #### 'success' #### 'fail' #### 'buffer' ```javascript nodeHttp.on('buffer', function (buffer) { }); ``` #### status code ```javascript nodeHttp.on(200, function (response) { }); ``` #### status name ```javascript nodeHttp.on('Ok', function (response) { }); nodeHttp.on('Not Found', function (response) { }); ``` ## Todo - parse `charset` from html and content-type header ## License MIT
评论
    相关推荐