Using "com.eed3si9n" %% "gigahorse-okhttp" % "0.6.0"
import gigahorse.support.okhttp.Gigahorse
val config = Gigahorse.config.withAuth(user, token, AuthScheme.Basic)
val http = Gigahorse.http(config)
val request = Gigahorse.url(s"https://api.github.com/repos/$privateRepo")
// .withAuth(user, token, AuthScheme.Basic)
val response = Await.result(http.run(request), Duration.Inf)
println(response.status)
where:
- `user` is a Github user
- `token` is a Github Personal Access Token with full control over private repositories
- `privateRepo` is a private Github repository: e.g., `"org/private-repo"`
## Problem
It throws a `gigahorse.StatusError: Unexpected status: 404`.
Same result if I put the authentication in the request instead of the config.
## Expectation
It should return `OK`
## Notes
The same piece of code works with `gigahorse-akka-http`
## Workaround
I can manually set the `Authorization` header and it works:
```scala
val authorization = Base64.getEncoder().encodeToString((s"$user:$token").getBytes("UTF-8"))
val request = Gigahorse
.url(s"https://api.github.com/repos/$privateRepo")
.addHeaders(
"Authorization" -> s"Basic $authorization"
)
Steps to reproduce
"com.eed3si9n" %% "gigahorse-okhttp" % "0.6.0"
val config = Gigahorse.config.withAuth(user, token, AuthScheme.Basic) val http = Gigahorse.http(config) val request = Gigahorse.url(s"https://api.github.com/repos/$privateRepo") // .withAuth(user, token, AuthScheme.Basic)
val response = Await.result(http.run(request), Duration.Inf) println(response.status)