项目作者: realglobe-Inc

项目描述 :
Base class of HTTP clients for SUGOS
高级语言: JavaScript
项目地址: git://github.com/realglobe-Inc/sugo-agent-base.git
创建时间: 2016-06-27T03:28:04Z
项目社区:https://github.com/realglobe-Inc/sugo-agent-base

开源协议:MIT License

下载


sugo-agent-base

Build Status
npm Version
JS Standard

Base class of HTTP clients for SUGOS

Installation

  1. $ npm install sugo-agent-base --save

Usage

  1. 'use strict'
  2. const { SugoAgentBase } = require('sugo-agent-base')
  3. const co = require('co')
  4. class YourCustomAgent extends SugoAgentBase() {
  5. constructor (url, options = {}) {
  6. super(url, options)
  7. /* ... */
  8. }
  9. doSomething (/* ... */) {
  10. const s = this
  11. let { request, url } = s
  12. return co(function * () {
  13. let { statusCode, body } = request.post(`${url}/hoge`, {
  14. data: {}
  15. })
  16. /* ... */
  17. })
  18. }
  19. }
  20. let agent = new YourCustomAgent()
  21. /* ... */

License

This software is released under the MIT License.