/**
* Generic reactive REST client.
*/
+@SuppressWarnings("java:S4449") // @Add Nullable to third party api
public class AsyncRestClient {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
}
public Mono<String> postWithAuthHeader(String uri, String body, String username, String password,
- MediaType mediaType) {
+ @Nullable MediaType mediaType) {
Object traceTag = createTraceTag();
logger.debug("{} POST (auth) uri = '{}{}''", traceTag, baseUrl, uri);
logger.trace("{} POST body: {}", traceTag, body);
return retrieve(traceTag, request);
}
- public Mono<ResponseEntity<String>> putForEntity(String uri) {
- Object traceTag = createTraceTag();
- logger.debug("{} PUT uri = '{}{}''", traceTag, baseUrl, uri);
- logger.trace("{} PUT body: <empty>", traceTag);
- RequestHeadersSpec<?> request = getWebClient() //
- .put() //
- .uri(uri);
- return retrieve(traceTag, request);
- }
-
public Mono<String> put(String uri, String body) {
return putForEntity(uri, body) //
.map(this::toBody);