我正在使用以下代码向akka-http
Akka Actor 内部的库发出 HTTP 请求:
implicit val materializer = ActorFlowMaterializer()
implicit val system = context.system
val request = HttpRequest(HttpMethods.GET, "http://ya.ru")
val content = for {
response <- Http().singleRequest(request)
content <- Unmarshal(response.entity).to[String]
} yield content
一切正常,但现在我想发出 HTTPS 请求(只需替换http://
为https://
)。之后,content
变量将包含以下响应:
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>
看起来像akka-http
不支持 HTTPS 协议。发送 HTTPS 请求使用是否正确或可能akka-http
?