r2

HTTP client. Spiritual successor to request.

  • 所有者: mikeal/r2
  • 平台:
  • 許可證: Apache License 2.0
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

r2

Build Status Coverage Status Greenkeeper badge

Early in Node.js I wrote an HTTP client library called request. It evolved
along with Node.js and eventually became very widely depended upon.

A lot has changed since 2010 and I've decided to re-think what a simple
HTTP client library should look like.

This new library, r2, is a completely new approach from request.

  • Rather than being built on top of the Node.js Core HTTP library and
    shimmed for the browser, r2 is built on top of the browser's
    Fetch API and shimmed for Node.js.
  • APIs are meant to be used with async/await, which means they are
    based on promises.
const r2 = require('r2')

let html = await r2('https://www.google.com').text

Simple JSON support.

let obj = {ok: true}

let resp = await r2.put('http://localhost/test.json', {json: obj}).json

Simple headers support.

let headers = {'x-test': 'ok'}

let res = await r2('http://localhost/test', {headers}).response

Being written to the Fetch API is a huge benefit for browser users.

When running through browserify request is ~2M uncompressed and ~500K compressed. r2 is only 66K uncompressed and 16K compressed.

主要指標

概覽
名稱與所有者mikeal/r2
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證Apache License 2.0
所有者活动
創建於2017-08-30 23:50:18
推送於2019-09-01 16:23:58
最后一次提交2018-05-27 19:01:38
發布數3
最新版本名稱v2.0.1 (發布於 )
第一版名稱v1.1.0 (發布於 )
用户参与
星數4.4k
關注者數59
派生數115
提交數40
已啟用問題?
問題數50
打開的問題數21
拉請求數20
打開的拉請求數9
關閉的拉請求數8
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?