(self, *args, headers: Optional[dict] = None, **kwargs)
| 337 | 'Try upgrading "dwave-cloud-client".') |
| 338 | |
| 339 | def request(self, *args, headers: Optional[dict] = None, **kwargs) -> requests.Response: |
| 340 | # (1) communicate lower bound on version handled in the outgoing request |
| 341 | # (via media type in `Accept` header field) |
| 342 | if self._media_type is not None: |
| 343 | params = {} if self._media_type_params is None else self._media_type_params.copy() |
| 344 | if self._ask_version: |
| 345 | params['version'] = self._ask_version |
| 346 | |
| 347 | headers = {} if headers is None else headers.copy() |
| 348 | headers['Accept'] = werkzeug.http.dump_options_header(self._media_type, params) |
| 349 | |
| 350 | response = super().request(*args, headers=headers, **kwargs) |
| 351 | |
| 352 | # (2) validate format/version supported in the incoming response |
| 353 | # (validate `Content-Type` if `media_type` and/or `accept_version` set) |
| 354 | if self._media_type is not None: |
| 355 | self._validate_response_content_type(response) |
| 356 | |
| 357 | return response |
| 358 | |
| 359 | |
| 360 | class VersionedAPISession(VersionedAPISessionMixin, PayloadCompressingSession): |
nothing calls this directly
no test coverage detected