我尝试将单个API请求发送到JSON中的URL,但我可以发送JSON请求。
我尝试在scala中使用以下代码
val uri = "https://test.com/mock-sms/receive"
val body = FormData(Map("to" -> "+837648732&", "content" -> "Hello")).toEntity
val respEntity: Future[ByteString] = for {
request <- Marshal(body).to[RequestEntity]
response <- Http().singleRequest(HttpRequest(method = HttpMethods.POST, uri = uri, entity = request))
entity <- Unmarshal(response.entity).to[ByteString]
} yield entity
如何以JSON格式发送上述请求?
https://stackoverflow.com/questions/56568743
复制相似问题