# Couldn't pass payload via Unity Client with http\_key

**URL:** <https://forum.heroiclabs.com/t/couldnt-pass-payload-via-unity-client-with-http-key/516>\
**Category:** Game Design\
**Created:** [February 19, 2020, 7:15am UTC](https://forum.heroiclabs.com/t/couldnt-pass-payload-via-unity-client-with-http-key/516 "2020-02-19T07:15:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![opus\_kojiro](https://avatars.discourse-cdn.com/v4/letter/o/b487fb/32.png) [@opus\_kojiro](https://forum.heroiclabs.com/u/opus_kojiro)\
**Post date:** [February 19, 2020, 7:15am UTC](https://forum.heroiclabs.com/t/couldnt-pass-payload-via-unity-client-with-http-key/516/1 "2020-02-19T07:15:15Z")

</div>

I want to pass payload to RPC func in Unity with http key.

This is C# code  
`var apiRpc = await client.RpcAsync(httpKey, "test", "{\"Val\": \"a\"}");`

But payload string is always empty in go module.

When I use curl like this  
`curl "http://127.0.0.1:7350/v2/rpc/test?http_key=<http key>" -d '"{\"Val\": \"a\"}"' -H 'Content-Type: application/json' -H 'Accept: application/json'`

Go module get correct payload.

When I use ISession with client.RpcAsync, it work fine.  
But I need to call rpc func without login in some cases.

How do I pass payload string without session?

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [February 19, 2020, 3:13pm UTC](https://forum.heroiclabs.com/t/couldnt-pass-payload-via-unity-client-with-http-key/516/2 "2020-02-19T15:13:28Z")

</div>

Hey @opus_kojiro. I think this could be a limitation in the Unity client sdk. Please can you open an issue or pull request for the feature:

> **[heroiclabs/nakama-unity](https://github.com/heroiclabs/nakama-unity)**
>
> Unity client for Nakama server. Contribute to heroiclabs/nakama-unity development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![opus\_kojiro](https://avatars.discourse-cdn.com/v4/letter/o/b487fb/32.png) [@opus\_kojiro](https://forum.heroiclabs.com/u/opus_kojiro)\
**Post date:** [February 20, 2020, 3:47am UTC](https://forum.heroiclabs.com/t/couldnt-pass-payload-via-unity-client-with-http-key/516/3 "2020-02-20T03:47:32Z")

</div>

I wonder it is nakama-dotnet’s issue.

In ApiClient.gen.cs  
RpcFunc2Async() send parameter as GET.  
But I couldn’t find the code reading payload parameter from query in go code.

Now I found a workaround of this issue by using HttpClient directly.  
The payload parameter is unwrapped in go code. So need to enclose in parentheses.

I think adding “unwrap” parameter is useful in this case.  
But I don’t know this is correct way…

Like this.

```
        var json = "\"{\\\"Val\\\": \\\"a\\\"}\""; // this is unwrapped to {\"Val\": \"a\"} in go 
        // var json = "{\"Val\": \"a\"}"; // unwrap version

        using (var httpClient = new HttpClient())
        {
            var content = new StringContent(json, Encoding.UTF8, "application/json");
            var accept = new MediaTypeWithQualityHeaderValue("application/json");
            httpClient.DefaultRequestHeaders.Accept.Add(accept);

            var response = await httpClient.PostAsync("http://127.0.0.1:7350/v2/rpc/test?http_key=key", content);
            // var response = await httpClient.PostAsync("http://127.0.0.1:7350/v2/rpc/test?http_key=key&unwrap=1", content); // unwrap version

            ...
        }
```

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [February 23, 2020, 9:24pm UTC](https://forum.heroiclabs.com/t/couldnt-pass-payload-via-unity-client-with-http-key/516/4 "2020-02-23T21:24:21Z")

</div>

@opus_kojiro The unwrap argument was one we added recently to the server so its not covered yet in the client sdk. I think definitely open a feature request for an update to include it in the .NET client so we can provide it with Unity engine too. 👍
