Repository: dapr/python-sdk

Issue:
DaprInvocationHttpClient should correctly populate headers in InvokeMethodResponse
## Expected Behavior

DaprInvocationHttpClient should correctly populate headers in InvokeMethodResponse


## Actual Behavior

DaprInvocationHttpClient does not correctly populate headers in InvokeMethodResponse


## Steps to Reproduce the Problem

Environment:
Self-Hosted
Mac OS 12.3.1
CLI version: 1.7.0
Runtime version: 1.7.0
dapr python sdk: 1.6


Set up a dapr sidecar and HTTP service with a valid endpoint.
Then use the python api to invoke. Headers will not be populated.
```
with DaprClient() as d:
     print(d.invoke_method('service',method','').headers)
```

I suspect the issue is in [this code](https://github.com/dapr/python-sdk/blob/d783ed2538bac6b464a5f1678b202e9edf69d7c8/dapr/clients/http/dapr_invocation_http_client.py#L101)


Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/dapr/python-sdk/pull/402?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) Report
> Merging [#402](https://codecov.io/gh/dapr/python-sdk/pull/402?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) (5198ddd) into [master](https://codecov.io/gh/dapr/python-sdk/commit/c57b872bcd263c5a856b8b0caf3e0075cde4fd92?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) (c57b872) will **increase** coverage by `0.01%`.
> The diff coverage is `100.00%`.

```diff
@@            Coverage Diff             @@
##           master     #402      +/-   ##
==========================================
+ Coverage   89.41%   89.43%   +0.01%     
==========================================
  Files          55       55              
  Lines        2448     2451       +3     
==========================================
+ Hits         2189     2192       +3     
  Misses        259      259              
```


| [Impacted Files](https://codecov.io/gh/dapr/python-sdk/pull/402?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) | Coverage Δ | |
|---|---|---|
| [dapr/clients/http/dapr\_invocation\_http\_client.py](https://codecov.io/gh/dapr/python-sdk/pull/402/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr#diff-ZGFwci9jbGllbnRzL2h0dHAvZGFwcl9pbnZvY2F0aW9uX2h0dHBfY2xpZW50LnB5) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/dapr/python-sdk/pull/402?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/dapr/python-sdk/pull/402?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr). Last update [c57b872...5198ddd](https://codecov.io/gh/dapr/python-sdk/pull/402?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr).

berndverst: @mukundansundar please take a look

Patch:
diff --git a/dapr/clients/http/dapr_invocation_http_client.py b/dapr/clients/http/dapr_invocation_http_client.py
index 97b6020..623df62 100644
--- a/dapr/clients/http/dapr_invocation_http_client.py
+++ b/dapr/clients/http/dapr_invocation_http_client.py
@@ -97,8 +97,12 @@ class DaprInvocationHttpClient:
                 query_params=query_params)
 
             resp_data = InvokeMethodResponse(resp_body, r.content_type)
+            respHeaders = resp_data.headers
             for key in r.headers:
-                resp_data.headers[key] = r.headers.getall(key)  # type: ignore
+                respHeaders[key] = r.headers[key]  # type: ignore
+
+            headerTuples = [(k, v) for k, v in respHeaders.items()]
+            resp_data.headers = headerTuples  # type: ignore
             return resp_data
         return await make_request()
 


Test patch:
diff --git a/tests/clients/test_http_service_invocation_client.py b/tests/clients/test_http_service_invocation_client.py
index f910263..7dfd3c2 100644
--- a/tests/clients/test_http_service_invocation_client.py
+++ b/tests/clients/test_http_service_invocation_client.py
@@ -137,6 +137,7 @@ class DaprInvocationHttpClientTests(unittest.TestCase):
         self.assertEqual(b"\x0a\x04test", self.server.get_request_body())
         # unpack to new protobuf object
         new_resp = common_v1.StateItem()
+        self.assertEqual(resp.headers['Content-Type'], ['application/x-protobuf'])
         resp.unpack(new_resp)
         self.assertEqual('resp', new_resp.key)