1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

code format

This commit is contained in:
pengbingting 2018-12-18 15:31:12 +08:00
parent 92f728176a
commit 77ac9a9cd6

View File

@ -38,42 +38,42 @@ import java.util.Map;
*/
public class SentinelClientHttpResponse extends AbstractClientHttpResponse {
private String blockResponse = "RestTemplate request block by sentinel";
private String blockResponse = "RestTemplate request block by sentinel";
public SentinelClientHttpResponse() {
}
public SentinelClientHttpResponse() {
}
public SentinelClientHttpResponse(String blockResponse) {
this.blockResponse = blockResponse;
}
public SentinelClientHttpResponse(String blockResponse) {
this.blockResponse = blockResponse;
}
@Override
public int getRawStatusCode() throws IOException {
return HttpStatus.OK.value();
}
@Override
public int getRawStatusCode() throws IOException {
return HttpStatus.OK.value();
}
@Override
public String getStatusText() throws IOException {
return blockResponse;
}
@Override
public String getStatusText() throws IOException {
return blockResponse;
}
@Override
public void close() {
// nothing do
}
@Override
public void close() {
// nothing do
}
@Override
public InputStream getBody() throws IOException {
return new ByteArrayInputStream(blockResponse.getBytes());
}
@Override
public InputStream getBody() throws IOException {
return new ByteArrayInputStream(blockResponse.getBytes());
}
@Override
public HttpHeaders getHeaders() {
Map<String, List<String>> headers = new HashMap<>();
headers.put(HttpHeaders.CONTENT_TYPE,
Arrays.asList(MediaType.APPLICATION_JSON_UTF8_VALUE));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.putAll(headers);
return httpHeaders;
}
@Override
public HttpHeaders getHeaders() {
Map<String, List<String>> headers = new HashMap<>();
headers.put(HttpHeaders.CONTENT_TYPE,
Arrays.asList(MediaType.APPLICATION_JSON_UTF8_VALUE));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.putAll(headers);
return httpHeaders;
}
}