47degrees/github4s

Support for error "Moved Permanently"

dev590t opened this issue · 2 comments

Reproduce

  val getRepo = gh.repos.get("lihaoyi", "utest")
  getRepo.unsafeRunSync().result match {
    case Left(e) => {
      println(s"Something went wrong for : ${e.getMessage}")
      None
    }
    case Right(r) => { Some(r) }
  }

get

Something went wrong for : Invalid message body: Could not decode JSON: {
  "message" : "Moved Permanently",
  "url" : "https://api.github.com/repositories/16268021",
  "documentation_url" : "https://docs.github.com/v3/#http-redirects"
}

It doesn't exist GHError to represent this message

@dev590t thanks for submitting the request. Please, use the FollowRedirect middleware in the client instance when creating a GitHub instance

Github[IO](FollowRedirect(1)(httpClient), accessToken)

I will try it, thanks