From 152cb5ea8a7452aad5e87691dcd32330ded294a6 Mon Sep 17 00:00:00 2001 From: Lam Wei Li Date: Sun, 18 Sep 2022 01:53:03 +0800 Subject: [PATCH] docs: updated http2 documentation following #1474 (5b86fd397264cb7b84634fa7ff00ad82214aa473) --- docs/index.md | 2 +- docs/zh_CN/index.html | 7 +++++++ docs/zh_CN/index.md | 9 +++++++++ index.html | 7 +++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 87bbc31ac..41ed8db83 100644 --- a/docs/index.md +++ b/docs/index.md @@ -95,7 +95,7 @@ The HTTP method defaults to __GET__, so if you wish, the following is valid: ## Using HTTP/2 -To make a request using HTTP/2 protocol only (with no HTTP/1.x fallback), use the `.http2()` method. Currently we do not have auto-detection of HTTP/2-capable servers. This feature is experimental. +To make a request using HTTP/2 protocol only (with no HTTP/1.x fallback), use the `.http2()` method. ```javascript const request = require('superagent'); diff --git a/docs/zh_CN/index.html b/docs/zh_CN/index.html index 6ba7d34b0..0ebba9d2d 100644 --- a/docs/zh_CN/index.html +++ b/docs/zh_CN/index.html @@ -73,6 +73,13 @@

基本请求

}); +

使用 HTTP/2

+

要使用 HTTP/2 协议(没有 HTTP/1.x 后备),请使用 .http2() 方法。

+
    const request = require('superagent');
+    const res = await request
+      .get('https://example.com/h2')
+      .http2();
+

设置请求头字段

设置请求头字段很简单,调用 .set() 时传入字段名称和值:

 request
diff --git a/docs/zh_CN/index.md b/docs/zh_CN/index.md
index 371fc55bf..2d4d8dfe1 100644
--- a/docs/zh_CN/index.md
+++ b/docs/zh_CN/index.md
@@ -77,6 +77,15 @@ HTTP 方法默认为 __GET__,因此如果您愿意,以下代码是有效的
 
      });
 
+## 使用 HTTP/2
+
+要使用 HTTP/2 协议(没有 HTTP/1.x 后备),请使用 `.http2()` 方法。
+
+    const request = require('superagent');
+    const res = await request
+      .get('https://example.com/h2')
+      .http2();
+
 ## 设置请求头字段
 
 设置请求头字段很简单,调用 `.set()` 时传入字段名称和值:
diff --git a/index.html b/index.html
index 99d584d99..8e898d9af 100644
--- a/index.html
+++ b/index.html
@@ -73,6 +73,13 @@ 

Request basics

});
+

Using HTTP/2

+

To make a request using HTTP/2 protocol only (with no HTTP/1.x fallback), use the .http2() method.

+
    const request = require('superagent');
+    const res = await request
+      .get('https://example.com/h2')
+      .http2();
+

Setting header fields

Setting header fields is simple, invoke .set() with a field name and value:

     request