10000 [Bug]: fulfillImpl does not set body if response specified · Issue #1792 · microsoft/playwright-java · GitHub
[go: up one dir, main page]

Skip to content

[Bug]: fulfillImpl does not set body if response specified #1792

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

Open
robstoll opened this issue May 16, 2025 · 0 comments
Open

[Bug]: fulfillImpl does not set body if response specified #1792

robstoll opened this issue May 16, 2025 · 0 comments

Comments

@robstoll
Copy link
robstoll commented May 16, 2025

Version

1.49.0

Steps to reproduce

kotlin code:

page.route({ it.startsWith(url}) { route ->
  val response = route.fetch()
  route.fulfill(Route.FulfillOptions().setResponse(response))
}

Expected behavior

I expect that the response is untouched routed through my mocker

Actual behavior

com.microsoft.playwright.impl.RouteImpl#fulfillImpl line 194

            APIResponseImpl response = (APIResponseImpl)options.response;
            if (response.context.connection == this.connection) {
                fetchResponseUid = response.fetchUid();
            } else {
                byte[] bodyBytes = response.body();
                body = Base64.getEncoder().encodeToString(bodyBytes);
                isBase64 = true;
                length = bodyBytes.length;
            }

No idea what response.context.connection == this.connection means but this branch is taken, omitting the body, modifying the request in an unexpected way

Additional context

As a workaround I set .setBodyBytes(response.body()) in addition

Environment

ubuntu 24, chrome, jdk 17

@robstoll robstoll changed the title [Bug]: Java: fulfillImpl does not set body if response specified [Bug]: fulfillImpl does not set body if response specified May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0