JSON object keys are defined in https://w3c.github.io/webdriver/#dfn-table-for-cookie-conversion.
()
| 233 | * https://w3c.github.io/webdriver/#dfn-table-for-cookie-conversion. |
| 234 | */ |
| 235 | public Map<String, Object> toJson() { |
| 236 | Map<String, Object> toReturn = new TreeMap<>(); |
| 237 | |
| 238 | if (getDomain() != null) { |
| 239 | toReturn.put("domain", getDomain()); |
| 240 | } |
| 241 | |
| 242 | if (getExpiry() != null) { |
| 243 | toReturn.put("expiry", getExpiry()); |
| 244 | } |
| 245 | |
| 246 | if (getName() != null) { |
| 247 | toReturn.put("name", getName()); |
| 248 | } |
| 249 | |
| 250 | if (getPath() != null) { |
| 251 | toReturn.put("path", getPath()); |
| 252 | } |
| 253 | |
| 254 | if (getValue() != null) { |
| 255 | toReturn.put("value", getValue()); |
| 256 | } |
| 257 | |
| 258 | toReturn.put("secure", isSecure()); |
| 259 | toReturn.put("httpOnly", isHttpOnly()); |
| 260 | |
| 261 | if (getSameSite() != null) { |
| 262 | toReturn.put("sameSite", getSameSite()); |
| 263 | } |
| 264 | |
| 265 | return toReturn; |
| 266 | } |
| 267 | |
| 268 | @Override |
| 269 | public String toString() { |