Skip to content

Commit

Permalink
Merge pull request #65 from Shudrum/updates
Browse files Browse the repository at this point in the history
Updates & fix encoded URL values from container
  • Loading branch information
Shudrum authored Mar 2, 2020
2 parents 7e53333 + 3241072 commit a8f8678
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 146 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "nodegate",
"description": "API gateway made simple, fast and easy to configure.",
"version": "1.3.0",
"version": "1.3.1",
"author": "Julien Martin <[email protected]>",
"license": "MIT",
"scripts": {
"test": "jest --runInBand",
"test": "jest",
"lint": "eslint .",
"doc:start": "cd docs && bundle exec jekyll serve",
"doc:install": "cd docs && bundle install"
Expand All @@ -16,15 +16,15 @@
"deepmerge": "^4.1.1",
"express": "^4.16.4",
"lodash": "^4.17.11",
"request": "^2.88.0",
"request": "^2.88.2",
"request-promise-native": "^1.0.7"
},
"devDependencies": {
"eslint": "^6.5.1",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.1",
"jest": "^25.1.0",
"nock": "^11.8.2",
"nock": "^12.0.2",
"supertest": "^4.0.2"
},
"repository": "weekendesk/nodegate",
Expand Down
2 changes: 1 addition & 1 deletion services/urlBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const getValue = (container, path) => {
if (value === undefined) {
throw new Error(`Missing value for {${path}}`);
}
return value;
return encodeURIComponent(value);
};

const mergeUrl = (container, parsedUrl) => {
Expand Down
9 changes: 9 additions & 0 deletions test/services/urlBuilder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,13 @@ describe('services/urlBuilder', () => {
};
expect(url(container)).toBe('http://wiki.federation.com/NCC-1700');
});
it('should encode values', () => {
const url = urlBuilder('http://wiki.federation.com/{body.shipPassword}');
const container = {
body: {
shipPassword: '//borgs & romulians are week$',
},
};
expect(url(container)).toEqual('http://wiki.federation.com/%2F%2Fborgs%20%26%20romulians%20are%20week%24');
});
});
Loading

0 comments on commit a8f8678

Please sign in to comment.