CarterCommunity / Carter

Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
MIT License
2.06k stars 174 forks source link

Bind<T> and camelcase #228

Closed lindsve closed 4 years ago

lindsve commented 4 years ago

I'm scratching my head here, and really don't get what I'm missing here

If I have this model:

public class Foo
{
    public string Bar {get; set;}
}

and return this from an endpoint: await httpResponse.AsJson(someInstanceOfBar);, then it is camelcased to proper Json:

{
    "bar": "someValue"
}

But if I post the same thing back and try to use await httpRequest.Bind<Foo>(); then it fails to deserialize due to casing differences, and I can't see any way to give Bind<T> any JsonSerializerOptions.

I'm sure it's something very obvious I'm missing here, but I fail to see it :)

jchannon commented 4 years ago

this has been fixed in master.

just setting up CI for .net 3.1 so there's no CI package you can use currently, obviously you can build from source if you like

jchannon commented 4 years ago

Please see the README for the link to the latest CI package where this is fixed