Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] attempt to pass all the headers from the paused request #15535

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion java/src/org/openqa/selenium/devtools/v134/v134Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,21 @@ protected Command<Void> continueRequest(RequestPaused pausedReq, HttpRequest req
}

List<HeaderEntry> headers = new ArrayList<>();
req.forEachHeader((name, value) -> headers.add(new HeaderEntry(name, value)));

// First add the original headers from the paused request to preserve them
pausedReq
.getRequest()
.getHeaders()
.forEach((name, value) -> headers.add(new HeaderEntry(name, String.valueOf(value))));

// Then add any new headers from the modified request, which will override existing ones if
// present
req.forEachHeader(
(name, value) -> {
// Remove any existing header with the same name
headers.removeIf(h -> h.getName().equalsIgnoreCase(name));
headers.add(new HeaderEntry(name, value));
});

return Fetch.continueRequest(
pausedReq.getRequestId(),
Expand Down