# http_client: Support \`GITHUB_TOKEN\` env to auth GitHub requests \(\#42623\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/2f46e6a43cd50e673b99c20d61c6d699ae9bcdb9)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 2f46e6a43cd50e673b99c20d61c6d699ae9bcdb9

Requested commit: 2f46e6a43cd50e673b99c20d61c6d699ae9bcdb9

Commit: 2f46e6a43cd50e673b99c20d61c6d699ae9bcdb9

Tree: 67d3be8990848a53a47d10e69fa58d8658b7b23d

Author: Binlogo

Committer: GitHub

## Message

````
http_client: Support `GITHUB_TOKEN` env to auth GitHub requests (#42623)

Closes #33903

Release Notes:

- Ensured Zed reuses `GITHUB_TOKEN` env variable when querying GitHub

---

Before fixing:

-  The `crates-lsp` extension request captured:
```
curl 'https://api.github.com/repos/MathiasPius/crates-lsp/releases' \
-H 'accept: */*' \
-H 'user-agent: Zed/0.212.3 (macos; aarch64)' \
-H 'host: api.github.com' \
```

-  `crates-lsp` extension error: 
```
Language server crates-lsp:

from extension "Crates LSP" version 0.2.0: status error 403, response: "{\"message\":\"API rate limit exceeded for x.x.x.x. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting\"}\n"
```

After fixing:

```
export GITHUB_TOKEN=$(gh auth token)
cargo run
```

-  The `crates-lsp` extension request captured:
```
curl 'https://api.github.com/repos/MathiasPius/crates-lsp/releases' \
-H 'authorization: Bearer gho_Nt*****************2KXLw2' \
-H 'accept: */*' \
-H 'user-agent: Zed/0.214.0 (macos; aarch64)' \
-H 'host: api.github.com' \
```

The API rate limitation is resolved.

---

This isn't a perfect solution, but it enables users to avoid the noise.
````

## Parents

- [d333535e768f349021a39a78c3afcc75f950f0c3](https://git.cafe/gitcafe/zed/commit/d333535e768f349021a39a78c3afcc75f950f0c3?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/2f46e6a43cd50e673b99c20d61c6d699ae9bcdb9?format=markdown)
