taglius
taglius

Reputation: 1247

Service returning string only has added quotes when coming from the cache

I built a simple Hello service that uses the cache. DTO:

[DataContract]
[Route("/cachedhello/{Name}")]
public class CachedHello : IReturn<string>
{
   [DataMember]
   public string Name { get; set; }

   public string CacheKey
   { get { return "urn:cachedhello:nm=" + Name; } }
}

Here is the service:

 public class CachedHelloService : Service
    {
        public ICacheClient CacheClient { get; set; }

        public object Any(CachedHello request)
        {
            return base.Request.ToOptimizedResultUsingCache(
                 this.CacheClient, request.CacheKey, CacheExpiryTime.DailyLoad(), () =>
                 {
                     return "(Cached) Hello, " + request.Name;
                 });
        }
    }

When I use the JSONServiceClient to call this service, the returned string has quotes around it. when I look at the cache entries in my database, it does look like an extra set of quotes have been put around the .json version of the entry:

urn:cachedhello:nm=Matt                    (Cached) Hello, Matt
urn:cachedhello:nm=Matt.json               """(Cached) Hello, Matt"""
urn:cachedhello:nm=Matt.json.deflate       U9JwTkzOSE3RVPBIzcnJ11HwTSwpUQIA

Here's the code that calls the service from VB.NET

Dim s = _ServiceClient.Send(Of String)(New CachedHello() With {.Name = "Matt"})

Upvotes: 0

Views: 39

Answers (1)

mythz
mythz

Reputation: 143339

We've removed double-encoding of raw string responses in this commit. This issue should now resolved in the latest v4.0.33+ of ServiceStack that's now available on MyGet.

Upvotes: 1

Related Questions