github4s icon indicating copy to clipboard operation
github4s copied to clipboard

HttpClient.delete fails with Malformed message body: Invalid JSON: empty body

Open dcsobral opened this issue 5 years ago • 0 comments

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
  }

dcsobral avatar May 04 '20 20:05 dcsobral