Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set decodeName/encodeName #151

Closed
adammw opened this issue Sep 23, 2014 · 1 comment
Closed

Can't set decodeName/encodeName #151

adammw opened this issue Sep 23, 2014 · 1 comment

Comments

@adammw
Copy link

adammw commented Sep 23, 2014

Following the style in styles/ams.js I added this to my code, however restmod doesn't seem to be calling decodeName or encodeName at all. (This is with restmod v1.1.0)

MyModule.config(function(restmodProvider) {
   restmodProvider.rebase('MyAPIPacker');
});

MyModule.factory('MyAPIPacker', function(restmod, inflector, DefaultPacker) {
  return restmod.mixin('DefaultPacker', {
    $config: {
      style: 'MyAPI',
      jsonMeta: '.',
      jsonLinks: '.'
    },
    $methods: {
      // special snakecase to camelcase renaming
      type: {
        decodeName: function(_v) { debugger; inflector.camelize(_v); },
        encodeName: function(_v) { debugger; return inflector.parameterize(_v, '_'); }
      }
    },
    $hooks: {
      // Add .json to all requests
      'before-request': function(req) {
        req.url += '.json';
      }
    }
  });
});
@iobaixas
Copy link
Member

Thanks for the report! that happens when I think there is no need for tests... Added proper tests for the style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants