我有一个包含字符串的文件,我想在每次X记录时读取它。我有两个问题:
如何从我的文件中读取X记录并将其作为json发送给HttpRequestBuilder作为正文?例如:
val request: HttpRequestBuilder = Utils.createPostBodyRequest(
"request",
"localhost:8080/request",
Map(Constants.Content_Type -> Constants.Application_Json),
ElFileBody("records.json"))
def createPostBodyRequest(reqName: String, url: String,
headers: Map[String, String], body: Body): HttpRequestBuilder = {
http(reqName)
.post(url)
.headers(headers)
.body(body)
}
答案 0 :(得分:0)