|
3 | 3 | import com.aftership.sdk.auth.AuthenticationType; |
4 | 4 | import com.aftership.sdk.auth.SignHeader; |
5 | 5 | import com.aftership.sdk.auth.SignatureContent; |
| 6 | +import com.aftership.sdk.utils.*; |
6 | 7 | import com.google.gson.JsonElement; |
7 | 8 | import com.google.gson.JsonParser; |
8 | 9 |
|
9 | | -import java.time.ZoneOffset; |
10 | | -import java.time.ZonedDateTime; |
11 | | -import java.time.format.DateTimeFormatter; |
12 | | -import java.util.AbstractMap; |
13 | | -import java.util.HashMap; |
14 | | -import java.util.Map; |
15 | | -import java.util.Objects; |
| 10 | +import java.text.SimpleDateFormat; |
| 11 | +import java.util.*; |
16 | 12 |
|
17 | 13 | import com.aftership.sdk.AfterShip; |
18 | 14 | import com.aftership.sdk.exception.AftershipException; |
|
23 | 19 | import com.aftership.sdk.model.AftershipResponse; |
24 | 20 | import com.aftership.sdk.model.Meta; |
25 | 21 | import com.aftership.sdk.model.RateLimit; |
26 | | -import com.aftership.sdk.utils.Define; |
27 | | -import com.aftership.sdk.utils.JsonUtils; |
28 | | -import com.aftership.sdk.utils.StrUtils; |
29 | | -import com.aftership.sdk.utils.UrlUtils; |
30 | 22 | import okhttp3.Call; |
31 | 23 | import okhttp3.Headers; |
32 | 24 | import okhttp3.MediaType; |
@@ -107,7 +99,9 @@ public <T, R> AftershipResponse<R> makeRequest( |
107 | 99 | if (authenticationType == AuthenticationType.AES) { |
108 | 100 | requestHeaders.put("as-api-key", app.getApiKey()); |
109 | 101 | // add sign |
110 | | - String date = DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now(ZoneOffset.UTC)); |
| 102 | + SimpleDateFormat sdf3 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); |
| 103 | + sdf3.setTimeZone(TimeZone.getTimeZone("GMT")); |
| 104 | + String date = sdf3.format(new Date()); |
111 | 105 | SignHeader signHeader = app.getSigner().sign( |
112 | 106 | SignatureContent.builder() |
113 | 107 | .contentType(JSON.toString()) |
|
0 commit comments