Skip to content

[flutter_web] --web-header flag does not work for flutter drive #159037

@dt-iohk

Description

@dt-iohk

Steps to reproduce

  1. Call flutter drive --help --verbose to see docs on how to use the --web-header flag:
   --web-header=<X-Custom-Header=header-value>              Additional key-value pairs that will added by the web server as headers to all responses. Multiple
                                                             headers can be passed by repeating "--web-header" multiple times.
  1. Clone flutter repository, navigate to /dev/integration_tests/web_e2e_tests, run the test with a --web-header flag with --no-headless so that the browser window appears:
chromedriver --port=4444 

flutter drive --target=test_driver/text_editing_integration.dart \
  -d web-server \
  --browser-name=chrome \
  --profile \
  --web-renderer=html \
  --web-header="test-header=test-value" \ 
  --no-headless
  1. Inspect the headers the index.html and other files are served with.

Expected results

test-header with test-value appears as HTTP header for each file served by the server.

Screenshot 2024-11-16 at 22 13 43

Actual results

The server doesn't add the HTTP header. The --web-header flag has no effect.

Screenshot 2024-11-16 at 22 21 36

Code sample

Code sample

No code sample since the issue is reproducible on examples from the flutter repository. Refer to Steps to reproduce for details.

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.27.0-1.0.pre.530, on macOS 15.1 24B83 darwin-arm64, locale en-PL)
    ! Flutter version 3.27.0-1.0.pre.530 on channel [user-branch] at /Users/shemhazai/Projects/GitHub/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.95.2)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyt: flutter driver"flutter driver", flutter_drive, or a driver testteam-webOwned by Web platform teamtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions