ServiceComposer serializes responses using a JSON serializer. By default, responses are serialized using camel casing, a C# SampleProperty
property is serialized as sampleProperty
. Consumers can influence the response casing of a specific request by adding to the request an Accept-Casing
custom HTTP header. Accepted values are casing/camel
(default) and casing/pascal
.
Available starting with v1.8.0
Default response serialization casing is camel case. It's possible to configure a different default response serialization casing when configuring ServiceComposer:
public void ConfigureServices(IServiceCollection services)
{
services.AddRouting();
services.AddViewModelComposition(options =>
{
options.ResponseSerialization.DefaultResponseCasing = ResponseCasing.PascalCase;
});
}
Requests containing the Accept-Casing
custom HTTP header will still be honored.