0

For some reason, a POST requests fails with a timeout, while an according CURL request works perfectly fine. What could get wrong?

Working CURL request:

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

Not working Vert.x WebClient request:

  @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()
        }
      })
  }
Gaket
  • 6,533
  • 2
  • 37
  • 67
  • Can you try with `"/iam/v1/tokens"` instead of `"iam/v1/tokens"` – tsegismont Mar 26 '20 at 09:04
  • Thanks, it looks like it was some issue with the internet. After some time it started to work. And yes, you're right, it should have started with a slash. But at least 400 error started to come. – Gaket Mar 27 '20 at 01:55

0 Answers0