diff --git a/Momento/MomentoSigner.cs b/Momento/MomentoSigner.cs index a21d0ab9..294c8050 100644 --- a/Momento/MomentoSigner.cs +++ b/Momento/MomentoSigner.cs @@ -27,7 +27,7 @@ public MomentoSigner(string jwkJsonString) /// /// Create a pre-signed HTTPS URL. /// - /// Hostname of the SimpleCacheService. Use the value returned from CreateSigningKey's response. + /// Hostname of the SimpleCacheService. Use the value returned from CreateSigningKey's response. A rest keyword is prepended to the hostname /// The parameters used for generating a pre-signed URL /// public string CreatePresignedUrl(string hostname, SigningRequest signingRequest) @@ -38,8 +38,8 @@ public string CreatePresignedUrl(string hostname, SigningRequest signingRequest) return signingRequest.CacheOperation switch { - CacheOperation.GET => $"https://{hostname}/cache/get/{cacheName}/{cacheKey}?token={jwtToken}", - CacheOperation.SET => $"https://{hostname}/cache/set/{cacheName}/{cacheKey}?ttl_milliseconds={signingRequest.TtlSeconds * (ulong)1000}&token={jwtToken}", + CacheOperation.GET => $"https://rest.{hostname}/cache/get/{cacheName}/{cacheKey}?token={jwtToken}", + CacheOperation.SET => $"https://rest.{hostname}/cache/set/{cacheName}/{cacheKey}?ttl_milliseconds={signingRequest.TtlSeconds * (ulong)1000}&token={jwtToken}", _ => throw new NotImplementedException($"Unhandled {signingRequest.CacheOperation}") }; } diff --git a/MomentoTest/MomentoSignerTest.cs b/MomentoTest/MomentoSignerTest.cs index 6a978c24..0db53123 100644 --- a/MomentoTest/MomentoSignerTest.cs +++ b/MomentoTest/MomentoSignerTest.cs @@ -50,7 +50,7 @@ public void TestPresignedUrlForGet() bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult); Assert.True(result); Assert.Equal(Uri.UriSchemeHttps, uriResult.Scheme); - Assert.StartsWith("https://foobar.com/cache/get/testCacheName/testCacheKey?token=", url); + Assert.StartsWith("https://rest.foobar.com/cache/get/testCacheName/testCacheKey?token=", url); } [Fact] @@ -68,7 +68,7 @@ public void TestPresignedUrlForSet() bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult); Assert.True(result); Assert.Equal(Uri.UriSchemeHttps, uriResult.Scheme); - Assert.StartsWith("https://foobar.com/cache/set/testCacheName/testCacheKey?ttl_milliseconds=4294967295000&token=", url); + Assert.StartsWith("https://rest.foobar.com/cache/set/testCacheName/testCacheKey?ttl_milliseconds=4294967295000&token=", url); } [Fact] @@ -83,7 +83,7 @@ public void TestUrlEncoding() bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult); Assert.True(result); Assert.Equal(Uri.UriSchemeHttps, uriResult.Scheme); - Assert.StartsWith("https://foobar.com/cache/get/testCacheName/%23%24%26%5c%27%2b%2c%2f%3a%3b%3d%3f%40%5b%5d?token=", url); + Assert.StartsWith("https://rest.foobar.com/cache/get/testCacheName/%23%24%26%5c%27%2b%2c%2f%3a%3b%3d%3f%40%5b%5d?token=", url); } [Fact]