Skip to content

Commit

Permalink
Merge pull request #458 from openvinotoolkit/fix-http-request-action
Browse files Browse the repository at this point in the history
Correctly set headers in `HttpRequest` PostInferenceAction
  • Loading branch information
ljcornel authored Jul 4, 2024
2 parents dac34a3 + 1e7f88e commit efd325c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion geti_sdk/post_inference_hooks/actions/http_request_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ def __init__(

self.url = url
self.method = method

if headers is None:
headers = {}
self.headers = headers

self.include_data = include_prediction_data and method == "POST"
if self.include_data:
self.headers.update({"Content-Type": "application/json"})

self._repr_info_ = (
f"url=`{url}`, "
Expand Down Expand Up @@ -80,7 +85,6 @@ def __call__(
if self.include_data:
prediction_dict = PredictionRESTConverter.to_dict(prediction)
data = prediction_dict
self.headers.update({"Content-Type": "application/json"})

requests.request(
method=self.method, url=self.url, headers=self.headers, data=data
Expand Down

0 comments on commit efd325c

Please sign in to comment.