arobson / rabbot

Deprecated: Please see https://github.com/Foo-Foo-MQ/foo-foo-mq
MIT License
276 stars 129 forks source link

Feature request: Add default serializer for `json` #118

Closed shawninder closed 6 years ago

shawninder commented 6 years ago

I just spent quite a while debugging a problem only to realize that although the default serializers include application/json, they don't include just json.

So this is a feature request to add a default serializer for json. I think this can be achieved in one line in src/index.js, just after the var serializers = statement:

  serializers.json = serializers['application/json'];

What do you think?

shawninder commented 6 years ago

By the way, I can totally solve my problem by adding a custom serializer, just wondering if this particular one (json) would not benefit from being included directly in rabbot, out of the box.

arobson commented 6 years ago

@shawninder - I'd like to keep the standard serializer types limited to MIME type standards.

You can re-use the existing one like this:

rabbit.addSerializer('json', rabbit.serializer[ 'application/json' ]);