我想使用 Spring Webflux 向 Paysafe 测试环境发出授权请求。我试过这个:
Mono<AuthorizeRequest> transactionMono = Mono.just(transaction);
return client.post().uri("https://api.test.paysafe.com/cardpayments/v1/accounts/{id}/auths", "123456789")
.header(HttpHeaders.CONTENT_TYPE, "application/json")
.header(HttpHeaders.AUTHORIZATION, "Basic dGVz.......")
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON)
.body(transactionMono, AuthorizeRequest.class)
.retrieve()
.bodyToMono(AuthorizeResponse.class);
但我得到:
org.springframework.web.reactive.function.client.WebClientResponseException$BadRequest: 400 Bad Request
at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:174)
at org.springframework.web.reactive.function.client.DefaultWebClient$DefaultResponseSpec.lambda$createResponseException$15(DefaultWebClient.java:512)
你知道我怎么能解决这个问题吗?