Skip to content

Commit

Permalink
docs: reverted http2
Browse files Browse the repository at this point in the history
reverted from "Drop HTTP/2, as it doesn't work in Node 10 any more" (b08371c)
  • Loading branch information
lamweili authored Sep 16, 2022
1 parent 1e4f80f commit 9939810
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ 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.

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:
Expand Down

0 comments on commit 9939810

Please sign in to comment.