我有一个有put端点的服务。我想要能够访问网址和身体。我怎样才能做到这一点。
这是我的端点:
put("/:customerNum") { foo: Foo =>
val custNum = ???
}如何访问customerNum?
发布于 2017-10-13 13:25:50
在这里,如何提取与请求相关的内容
put("/:customerNum") { request =>
// Get request body
val body = request.getContentString
// Get content type
val contentType = request.contentType
// Get customer number
val customerNum = request.routeParams.get("customerNum")
println(s"Customer number: ${customerNum}. Content Type: $contentType. Body: $body")
render.plain("ok").toFuture
}发布于 2017-10-13 13:07:35
put( / string) { (customerNumber: String) =>
s"$customerNumber!"
}https://stackoverflow.com/questions/46729645
复制相似问题