def test_explicit_user_set_headers(httpbin, tmp_path, target_httpbin, session, request):
    """
    User set headers ARE persisted within redirects even on different domains domain with or without an active session.

    """
    target_httpbin = request.getfixturevalue(target_httpbin)
    session_args = []
    if session:
        session_args.extend([
            '--session',
            str(tmp_path / 'session.json')
        ])
    r = http(
        '--follow',
        *session_args,
        httpbin + '/redirect-to',
        f'url=={target_httpbin}/get',
        'X-Custom-Header:value'
    )
    assert 'X-Custom-Header' in r.json['headers']

    User set headers ARE persisted within redirects even on different domains domain with or without an active session.

    
tests/test_cookie_on_redirects.py