Skip to content

Commit c9e4721

Browse files
committed
1. fix response get redid logic
2. fix failed tests
1 parent 66fd667 commit c9e4721

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/java/com/qiniu/http/Response.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ public static Response create(okhttp3.Response response, String address, double
6868
String error = null;
6969
int code = response.code();
7070
String reqId = null;
71+
reqId = response.header("X-Reqid");
72+
reqId = (reqId == null) ? null : reqId.trim();
7173

7274
byte[] body = null;
7375
if (ctype(response).equals(Client.JsonMime)) {
74-
reqId = response.header("X-Reqid");
75-
reqId = (reqId == null) ? null : reqId.trim();
7676
try {
7777
body = response.body().bytes();
7878
if (response.code() >= 400 && !StringUtils.isNullOrEmpty(reqId) && body != null) {
@@ -95,11 +95,11 @@ static Response createError(okhttp3.Response response, String address, double du
9595
}
9696
int code = response.code();
9797
String reqId = null;
98+
reqId = response.header("X-Reqid");
99+
reqId = (reqId == null) ? null : reqId.trim();
98100

99101
byte[] body = null;
100102
if (ctype(response).equals(Client.JsonMime)) {
101-
reqId = response.header("X-Reqid");
102-
reqId = (reqId == null) ? null : reqId.trim();
103103
try {
104104
body = response.body().bytes();
105105
if (response.code() >= 400 && !StringUtils.isNullOrEmpty(reqId) && body != null) {

src/test/java/com/qiniu/storage/BucketTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void testListUseDelimiter() {
5555
bucketManager.copy(TestConfig.bucket, TestConfig.key, TestConfig.bucket, "test/3/", true);
5656
FileListing l = bucketManager.listFiles(TestConfig.bucket, "test/", null, 10, "/");
5757
assertEquals(3, l.items.length);
58-
assertEquals(1, l.commonPrefixes.length);
58+
assertEquals(2, l.commonPrefixes.length);
5959

6060
} catch (QiniuException e) {
6161
e.printStackTrace();

0 commit comments

Comments
 (0)