小编Her*_*III的帖子

git checkout远程引用

我在github上有一个pull请求列表.我可以像这样获取拉取请求:

git fetch origin +refs/pull/*:refs/remotes/origin/pr/*
Run Code Online (Sandbox Code Playgroud)

我得到这样的输出:

* [new ref]         refs/pull/1/head -> origin/pr/1/head
* [new ref]         refs/pull/1/merge -> origin/pr/1/merge
* [new ref]         refs/pull/10/head -> origin/pr/10/head
* [new ref]         refs/pull/10/merge -> origin/pr/10/merge
* [new ref]         refs/pull/11/head -> origin/pr/11/head
* [new ref]         refs/pull/11/merge -> origin/pr/11/merge
Run Code Online (Sandbox Code Playgroud)

现在我想结帐其中一个参考.我没有尝试似乎工作:

$ git checkout refs/pull/1/head
error: pathspec 'refs/pull/1/head' did not match any file(s) known to git.
Run Code Online (Sandbox Code Playgroud)

要么:

git checkout origin/pr/1/head
error: pathspec 'origin/pr/1/head' did not match any file(s) known to git.
Run Code Online (Sandbox Code Playgroud)

我该如何查看此参考资料?

git github

8
推荐指数
1
解决办法
6342
查看次数

将json正文添加到http4s请求

这个tut展示了如何创建一个http4s请求:https://http4s.org/v0.18/dsl/#testing-the-service

我想将此请求更改为POST方法并使用circe添加文字json正文.我尝试了以下代码:

val body = json"""{"hello":"world"}"""
val req = Request[IO](method = Method.POST, uri = Uri.uri("/"), body = body)
Run Code Online (Sandbox Code Playgroud)

这给了我一个类型不匹配的错误:

[error]  found   : io.circe.Json
[error]  required: org.http4s.EntityBody[cats.effect.IO]
[error]     (which expands to)  fs2.Stream[cats.effect.IO,Byte]
[error]     val entity: EntityBody[IO] = body
Run Code Online (Sandbox Code Playgroud)

我理解错误,但我无法弄清楚如何转换io.circe.JsonEntityBody.我见过的大多数例子都使用了一个EntityEncoder,它没有提供所需的类型.

我怎样才能转换io.circe.JsonEntityBody

scala http4s http4s-circe

4
推荐指数
2
解决办法
2458
查看次数

标签 统计

git ×1

github ×1

http4s ×1

http4s-circe ×1

scala ×1