Skip to content

Commit

Permalink
Add origin header to the api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
skibitsky committed Nov 22, 2024
1 parent e1495c1 commit df02fbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;

namespace Reown.AppKit.Unity.Http
{
Expand All @@ -12,6 +13,12 @@ protected override Task<HttpResponseContext> SendAsyncCore(HttpRequestContext re
requestContext.RequestHeaders["x-sdk-type"] = "appkit";
requestContext.RequestHeaders["x-sdk-version"] = AppKit.Version;

var origin = Application.identifier;
if (!string.IsNullOrWhiteSpace(origin))
{
requestContext.RequestHeaders["origin"] = origin;
}

return next(requestContext, cancellationToken);
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/Reown.AppKit.Unity/Runtime/Utils/RemoteSprite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ private IEnumerator LoadRemoteSprite()
uwr.SetRequestHeader("x-sdk-type", "appkit");
uwr.SetRequestHeader("x-sdk-version", SignMetadata.Version);

var origin = Application.identifier;
if (!string.IsNullOrWhiteSpace(origin))
{
uwr.SetRequestHeader("origin", origin);
}

yield return uwr.SendWebRequest();

if (uwr.result != UnityWebRequest.Result.Success)
Expand Down

0 comments on commit df02fbf

Please sign in to comment.