Vert.x WebClient https帖子挂起

2020-03-26 kotlin vert.x vert.x-webclient

出于某种原因,POST请求失败并带有超时,而相应的CURL请求则可以正常工作。可能出什么问题了?

有效的CURL请求:

curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"jwt": "jwt"}' \
    https://iam.api.cloud.yandex.net/iam/v1/tokens

无法正常使用Vert.x WebClient请求:

  @Test
  fun `get api token`(vertx: Vertx, testContext: VertxTestContext) {
    val webClient = WebClient.create(vertx)
    webClient.post(443, "iam.api.cloud.yandex.net", "iam/v1/tokens")
      .putHeader("Content-Type", "application/json")
      .ssl(true)
      .sendJsonObject(JsonObject().put("jwt", "test"), testContext.succeeding {
        testContext.verify {
          Assertions.assertEquals(200, it.statusCode())
          testContext.completeNow()
        }
      })
  }

Answers

Related