Hello again, I am trying to switch between json and xml serializers in my Dancer2 app. Like change my serializer dynamically in my app. This is my code:
hook before => sub { set serializer => ( request->params->{format} eq 'xml' ? 'XML' : ' +JSON'); };
However, the first request always operates based on the old serializer so I have to call the request twice in a row to get the response using the correct serializer. If you can please help me with that. Thanks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |