Mono mono1 = (Mono) createUnsafeWebClient().post()
.uri(path)
.contentType(MediaType.MULTIPART_FORM_DATA)
.header("Accept", "text/event-stream")
.body(BodyInserters.fromMultipartData(buildFormData(chatQo)))
.exchange();
ClientResponse response = (ClientResponse) mono1.block();
HttpStatus statusCode = response.statusCode(); // 获取响应码
int statusCodeValue = response.rawStatusCode(); // 获取响应码值
if (statusCodeValue == 401) {
ClientResponse.Headers headers = response.headers(); // 获取响应头
//String contentType= headers.asHttpHeaders().getContentType().toString();
if (headers.asHttpHeaders().getContentType().toString().equals("application/json;charset=UTF-8")) {
// HttpClientErrorException e;
// refreshToken(e);
Mono resultMono = response.bodyToMono(String.class);
Object body = resultMono.block();
//String body1 = resultMono.block();
return executeStreamRequest(path, chatQo, apiName);
}
}