Authorization headers for direct HTTP calls to Cloud Run.
(cloud_run_url)
| 155 | |
| 156 | @pytest.fixture(scope="session") |
| 157 | def auth_headers(cloud_run_url) -> dict[str, str]: |
| 158 | """Authorization headers for direct HTTP calls to Cloud Run.""" |
| 159 | try: |
| 160 | resp = requests.get(cloud_run_url, timeout=10) |
| 161 | if resp.status_code != 403: |
| 162 | return {} |
| 163 | except requests.RequestException: |
| 164 | pass |
| 165 | |
| 166 | token = _get_identity_token(cloud_run_url) |
| 167 | if token: |
| 168 | return {"Authorization": f"Bearer {token}"} |
| 169 | return {} |
nothing calls this directly
no test coverage detected