Skip to content

Can't set decodeName/encodeName #151

@adammw

Description

@adammw

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';
      }
    }
  });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions