Skip to content

Commit

Permalink
Merge pull request #1738 from lamweili/patch-1
Browse files Browse the repository at this point in the history
docs: reverted http2
  • Loading branch information
titanism authored Sep 16, 2022
2 parents 1e4f80f + 9939810 commit fad7b59
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 fad7b59

Please sign in to comment.