36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
package vn.sis.appointment;
|
|
|
|
import java.time.Instant;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
|
|
record ProxyResponse(
|
|
boolean ok,
|
|
int httpStatus,
|
|
String statusText,
|
|
String method,
|
|
String url,
|
|
int attempts,
|
|
String body,
|
|
String requestInfo,
|
|
String responseHeaders,
|
|
Instant tokenExpiresAt,
|
|
String message) {
|
|
|
|
String toJson() {
|
|
Map<String, Object> values = new LinkedHashMap<>();
|
|
values.put("ok", ok);
|
|
values.put("httpStatus", httpStatus);
|
|
values.put("statusText", statusText);
|
|
values.put("method", method);
|
|
values.put("url", url);
|
|
values.put("attempts", attempts);
|
|
values.put("body", body == null ? "" : body);
|
|
values.put("requestInfo", requestInfo == null ? "" : requestInfo);
|
|
values.put("responseHeaders", responseHeaders == null ? "" : responseHeaders);
|
|
values.put("tokenExpiresAt", tokenExpiresAt == null ? null : tokenExpiresAt.toString());
|
|
values.put("message", message == null ? "" : message);
|
|
return Json.stringify(values);
|
|
}
|
|
}
|