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

Websockets: Support more route characters #5865

Merged
merged 2 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/plugins/aws/lib/naming.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ module.exports = {
}, },


getNormalizedWebsocketsRouteKey(route) { getNormalizedWebsocketsRouteKey(route) {
return route.replace('$', 'S'); return route
.replace('$', 'S') // dollar sign
.replace('/', 'Slash')
.replace('-', 'Dash')
.replace('_', 'Underscore')
.replace('.', 'Period');
}, },


getWebsocketsRouteLogicalId(route) { getWebsocketsRouteLogicalId(route) {
Expand Down
12 changes: 12 additions & 0 deletions lib/plugins/aws/lib/naming.test.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -259,6 +259,18 @@ describe('#naming()', () => {
it('should return a normalized version of the route key', () => { it('should return a normalized version of the route key', () => {
expect(sdk.naming.getNormalizedWebsocketsRouteKey('$connect')) expect(sdk.naming.getNormalizedWebsocketsRouteKey('$connect'))
.to.equal('Sconnect'); .to.equal('Sconnect');

expect(sdk.naming.getNormalizedWebsocketsRouteKey('foo/bar'))
.to.equal('fooSlashbar');

expect(sdk.naming.getNormalizedWebsocketsRouteKey('foo-bar'))
.to.equal('fooDashbar');

expect(sdk.naming.getNormalizedWebsocketsRouteKey('foo_bar'))
.to.equal('fooUnderscorebar');

expect(sdk.naming.getNormalizedWebsocketsRouteKey('foo.bar'))
.to.equal('fooPeriodbar');
}); });
}); });


Expand Down