Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with default route prefix #8

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,19 @@ The above is supported in the following SDKs;

* [PlayFab C# SDK](https://github.com/PlayFab/CSharpSDK)
* [PlayFab Unity SDK](https://github.com/PlayFab/UnitySDK)
* [Unreal 4 Marketplace PlugIn for PlayFab](https://github.com/PlayFab/UnrealMarketplacePlugin)
* [Unreal 4 Marketplace PlugIn for PlayFab](https://github.com/PlayFab/UnrealMarketplacePlugin)

## Custom route prefixes

If you use a custom route prefix in your host.json, you will need to change the /api/ part of the file content to match the custom route prefix specified in the host.json. For example, if your host.json specifies a route prefix
of 'cs', then your playfab.local.settings.json should be as follows;

```
{ "LocalApiServer": "http://localhost:7071/cs/" }
```

If your host.json specifies an empty custom route prefix, then your playfab.local.settings.jsoon should be as follows;

```
{ "LocalApiServer": "http://localhost:7071/" }
```
4 changes: 2 additions & 2 deletions csharp/ExecuteFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static class LocalExecuteFunction
private const string DEV_SECRET_KEY = "PLAYFAB_DEV_SECRET_KEY";
private const string TITLE_ID = "PLAYFAB_TITLE_ID";
private const string CLOUD_NAME = "PLAYFAB_CLOUD_NAME";
private const string _defaultRoutePrefix = "api";
private static readonly HttpClient httpClient = new HttpClient();

/// <summary>
Expand Down Expand Up @@ -327,8 +328,7 @@ private static string GetHostRoutePrefix()
}

var hostModel = PlayFabSimpleJson.DeserializeObject<HostJsonModel>(hostFileContent);

return hostModel?.extensions?.http?.routePrefix;
return hostModel?.extensions?.http?.routePrefix ?? _defaultRoutePrefix;
}

private static async Task<string> DecompressHttpBody(HttpRequest request)
Expand Down