github4s
github4s copied to clipboard
HttpClient.delete fails with Malformed message body: Invalid JSON: empty body
As it happens, HttpClient.delete is used when no body is expected from the server (as opposed to HttpCliente.deleteWithResponse).
I'm not sure if there's anything on github4s algebras using that method. I've used to to implement a delete reference:
def deleteReference(owner: String, repo: String, ref: String, headers: Map[String, String]): F[GHResponse[Unit]] = {
for {
_ <- Sync[F].delay(assert(ref.matches("refs/(heads|tags)/.+"), f"Invalid reference $ref%s"))
res <- client.delete(accessToken, f"repos/$owner%s/$repo%s/git/$ref%s")
} yield res
}