gpt4 book ai didi

AkkaHTTP : How to access captured values from the path when using mutlpart upload ( entity(as[ Multipart. 表单数据]) )

转载 作者:行者123 更新时间:2023-12-01 12:28:15 24 4
gpt4 key购买 nike

我试图在上传文件时从路径访问捕获的值,但无法了解实现的想法。

示例代码如下:

trait TestRoute extends {
val regEx = """(\w+)""".r
def testRoute: Route = path("testing" / regEx / regEx / regEx){
post {
//How do i Access (captured regex from the path) inside entity
entity(as[Multipart.FormData]) { fileData => {
complete {
"UpLoadDOne"
}
}
}
}
}

http://localhost:9000/testing/A/B/C

感谢您的帮助!

最佳答案

如果你使用喷雾,你需要这样的东西:

import spray.routing.PathMatchers.Segment

trait TestRoute extends {

def testRoute: Route = path("testing" / Segment / Segment / Segment){ case (A, B, C) =>
post {
entity(as[Multipart.FormData]) { fileData =>
complete {
"UpLoadDOne"
}
}
}
}

关于AkkaHTTP : How to access captured values from the path when using mutlpart upload ( entity(as[ Multipart. 表单数据]) ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37322688/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com