MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / fromJson

Method fromJson

java/src/org/openqa/selenium/bidi/network/Cookie.java:89–148  ·  view source on GitHub ↗
(JsonInput input)

Source from the content-addressed store, hash-verified

87 }
88
89 public static Cookie fromJson(JsonInput input) {
90 String name = null;
91 BytesValue value = null;
92 String domain = null;
93 String path = null;
94 Long size = null;
95 boolean isSecure = false;
96 boolean isHttpOnly = false;
97 SameSite sameSite = null;
98 Optional<Long> expiry = Optional.empty();
99
100 input.beginObject();
101 while (input.hasNext()) {
102 switch (input.nextName()) {
103 case "name":
104 name = input.read(String.class);
105 break;
106 case "value":
107 value = input.read(BytesValue.class);
108 break;
109 case "domain":
110 domain = input.read(String.class);
111 break;
112 case "path":
113 path = input.read(String.class);
114 break;
115 case "size":
116 size = input.read(Long.class);
117 break;
118 case "secure":
119 isSecure = input.readNonNull(Boolean.class);
120 break;
121 case "httpOnly":
122 isHttpOnly = input.readNonNull(Boolean.class);
123 break;
124 case "sameSite":
125 String sameSiteValue = input.readNonNull(String.class);
126 sameSite = SameSite.findByName(sameSiteValue);
127 break;
128 case "expiry":
129 expiry = Optional.of(input.readNonNull(Long.class));
130 break;
131 default:
132 input.skipValue();
133 }
134 }
135
136 input.endObject();
137
138 return new Cookie(
139 Require.nonNull("name", name),
140 Require.nonNull("value", value),
141 domain,
142 path,
143 size,
144 isSecure,
145 isHttpOnly,
146 sameSite,

Callers

nothing calls this directly

Calls 11

findByNameMethod · 0.95
nonNullMethod · 0.95
hasNextMethod · 0.80
nextNameMethod · 0.80
readNonNullMethod · 0.80
skipValueMethod · 0.80
readMethod · 0.65
emptyMethod · 0.45
beginObjectMethod · 0.45
ofMethod · 0.45
endObjectMethod · 0.45

Tested by

no test coverage detected