-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add User-Agent header to requests and introduce delay in dependencies…
… metadata retrieval in cargo
- Loading branch information
Showing
2 changed files
with
4 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,12 +204,15 @@ def get_raw(url, options = {}) | |
end | ||
|
||
def request(url, options = {}) | ||
options[:headers] ||= {} | ||
options[:headers]["User-Agent"] = "packages.ecosyste.ms ([email protected])" | ||
connection = Faraday.new url.strip, options do |builder| | ||
builder.use Faraday::FollowRedirects::Middleware | ||
builder.request :retry, { max: 5, interval: 0.05, interval_randomness: 0.5, backoff_factor: 2 } | ||
|
||
builder.request :instrumentation | ||
builder.adapter Faraday.default_adapter, accept_encoding: "gzip" | ||
|
||
end | ||
connection.get | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters