Skip to content

Commit b1f4ca5

Browse files
committed
attempt to pass all the headers from the paused reuqest
1 parent 1318f59 commit b1f4ca5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

java/src/org/openqa/selenium/devtools/v134/v134Network.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,17 @@ protected Command<Void> continueRequest(RequestPaused pausedReq, HttpRequest req
191191
}
192192

193193
List<HeaderEntry> headers = new ArrayList<>();
194-
req.forEachHeader((name, value) -> headers.add(new HeaderEntry(name, value)));
194+
195+
// First add the original headers from the paused request to preserve them
196+
pausedReq.getRequest().getHeaders().forEach(
197+
(name, value) -> headers.add(new HeaderEntry(name, String.valueOf(value))));
198+
199+
// Then add any new headers from the modified request, which will override existing ones if present
200+
req.forEachHeader((name, value) -> {
201+
// Remove any existing header with the same name
202+
headers.removeIf(h -> h.getName().equalsIgnoreCase(name));
203+
headers.add(new HeaderEntry(name, value));
204+
});
195205

196206
return Fetch.continueRequest(
197207
pausedReq.getRequestId(),

0 commit comments

Comments
 (0)