Skip to content

Commit

Permalink
Fix bug with custom header in request (#1000)
Browse files Browse the repository at this point in the history
* Custom header bug

* fix logic
  • Loading branch information
kt474 committed Aug 10, 2023
1 parent 8bcf622 commit f646b56
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions qiskit_ibm_runtime/api/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,19 @@ def request( # type: ignore[override]
if str(caller) in frame_path:
caller_str = str(caller) + frame_path.split(str(caller), 1)[-1]
sanitized_caller_str = caller_str.replace("/", "~")
headers.update(
{"X-Qx-Client-Application": f"{CLIENT_APPLICATION}/{sanitized_caller_str}"}
)
if self.custom_header:
headers.update(
{
"X-Qx-Client-Application": f"{CLIENT_APPLICATION}/"
f"{sanitized_caller_str}/{self.custom_header}"
}
)
else:
headers.update(
{
"X-Qx-Client-Application": f"{CLIENT_APPLICATION}/{sanitized_caller_str}"
}
)
found_caller = True
break # break out of the inner loop
if found_caller:
Expand Down

0 comments on commit f646b56

Please sign in to comment.