*/
package org.oransc.policyagent.clients;
+import org.oransc.policyagent.exceptions.AsyncRestClientException;
+import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
.contentType(MediaType.APPLICATION_JSON) //
.syncBody(body) //
.retrieve() //
+ .onStatus(HttpStatus::isError,
+ response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) //
.bodyToMono(String.class);
}
return client.get() //
.uri(uri) //
.retrieve() //
+ .onStatus(HttpStatus::isError,
+ response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) //
.bodyToMono(String.class);
}
return client.delete() //
.uri(uri) //
.retrieve() //
+ .onStatus(HttpStatus::isError,
+ response -> Mono.error(new AsyncRestClientException(response.statusCode().toString()))) //
.bodyToMono(Void.class);
}
}