Skip to content

Commit bfdf357

Browse files
committed
Add rate endpoint for debug
1 parent 8ee0d66 commit bfdf357

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

bot/src/dotty/tools/bot/PullRequestService.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ trait PullRequestService {
4242

4343
/** Pull Request HTTP service */
4444
val prService = HttpService {
45+
case GET -> Root / "rate" => {
46+
val client = PooledHttp1Client()
47+
for {
48+
rates <- client.expect(get(rateLimit))(EntityDecoder.text)
49+
resp <- Ok(rates)
50+
_ <- client.shutdown
51+
} yield resp
52+
}
53+
4554
case request @ POST -> Root =>
4655
val githubEvent =
4756
request.headers
@@ -77,6 +86,8 @@ trait PullRequestService {
7786
private[this] def withGithubSecret(url: String, extras: String*): String =
7887
s"$url?client_id=$githubClientId&client_secret=$githubClientSecret" + extras.mkString("&", "&", "")
7988

89+
def rateLimit: String = withGithubSecret("https://api.github.com/rate_limit")
90+
8091
def claUrl(userName: String): String =
8192
s"https://www.lightbend.com/contribute/cla/scala/check/$userName"
8293

0 commit comments

Comments
 (0)