嗨,我在上传视频时遇到错误。它说 -
“ akka.http.scaladsl.model.IllegalHeaderException:多部分/表单数据部分必须包含带有Content-Disposition
参数的name
标头”
.exec(
http("request_1") // Here's an example of a POST request
.post("upload?")
.headers(Map("Content-Type" -> "multipart/form-data"))
.headers(Map("Content-Disposition" -> """form-data; name="file""""))
.headers(Map("name" -> "file"))
.bodyPart(
RawFileBodyPart("xyz.MP4")
.contentType("video/mp4")
.fileName("xyz.MP4")
.dispositionType("Content-Disposition")
.addP
.fileName("xyz.MP4")
.header("Content-Disposition", "name")
)
.asMultipartForm
.queryParam("""xyz""", """true""") // Note the triple double quotes: used in Scala for protecting a whole chain of characters (no need for backslash)
在这里需要一些帮助。