2

In AppHost.Configure I set a global JSON config JsConfig.TreatEnumAsInteger = false; and have a simple handler with two GET endpoints

public object Get(GetDayOfWeekAsText request)
{
    return new GetDayOfWeekResponse();
}

public object Get(GetDayOfWeekAsInt request)
{
    return new HttpResult(new GetDayOfWeekResponse())
    {
        ResultScope = () => JsConfig.With(new Config
        {
            TreatEnumAsInteger = true
        })
    };
}

Depending on the request I call first all subsequent requests will serialize enums as text or integer until the application is recycled. Explicitly setting TreatEnumAsInteger in GetDayOfWeekAsText has no effect.

Thanks!

David
  • 1,143
  • 7
  • 9
  • The config impl has changed recently, can you confirm if this is still an issue with the latest v5.4.0 on NuGet? – mythz Oct 24 '18 at 05:03
  • Yes. Looked into it a bit further. `TreatEnumAsInteger` is used globally depending on the first endpoint hit. The `Emit___Names` values affect other requests sporadically. Seems like it might be caused by IIS thread re-use. – David Oct 24 '18 at 13:13

1 Answers1

0

This should now be resolved with this commit.

This change is available from v5.4.1 that's now available on MyGet.

mythz
  • 141,670
  • 29
  • 246
  • 390