borni69 1 Posted February 17, 2022 I have this code procedure THseqScimController.createUser; var aUser : TUser; begin aUser := Context.Request.BodyAs<TUser>; try if UserScimHandleClass.CreateUser(aUser) then begin Render(aUser,false); Context.Response.StatusCode:=201; end else raise EMVCException.Create(HTTP_STATUS.Conflict,'Conflict'); finally aUser.Free; end; End; It works great from postman with this content type application/json But when request come from Microsoft Azure it have this content type application/sim+json And it gives me an error on aUser := Context.Request.BodyAs<TUser>; Body content type not supported… Is there a way to change this application/sim+json to application/json or to add application/sim+json as a supported type ? I guess other option is to parse json and build the object myself Thanks Share this post Link to post
João Antônio Duarte 6 Posted February 21, 2022 By default DMVC registers a serializer only for the application/json content-type. But you can define a serializer for other types. In your WebModule, after creating the TMVCEngine add the following code: FEngine.Serializers.Add('application/sim+json', TMVCJSONDataObjectsSerializer.Create); Share this post Link to post
borni69 1 Posted February 23, 2022 (edited) On 2/21/2022 at 7:50 PM, João Antônio Duarte said: By default DMVC registers a serializer only for the application/json content-type. But you can define a serializer for other types. In your WebModule, after creating the TMVCEngine add the following code: FEngine.Serializers.Add('application/sim+json', TMVCJSONDataObjectsSerializer.Create); Great Thanks 🙂 Edited February 23, 2022 by borni69 Share this post Link to post