Skip to content

Commit

Permalink
Minor change to hypermedia()
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Nov 1, 2017
1 parent 670e082 commit cfa4b60
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions lib/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,7 @@ function bootstrap (obj) {
}

function hypermedia (server, req, rep, headers) {
const seen = {},
collection = req.parsed.pathname;
const collection = req.parsed.pathname;
let query, page, page_size, nth, root, proot, parent;

// Parsing the object for hypermedia properties
Expand All @@ -664,6 +663,8 @@ function hypermedia (server, req, rep, headers) {
if (keys.length === 0) {
result = null;
} else {
const seen = new Set();

retsu.each(keys, i => {
let lcollection, uri;

Expand All @@ -679,8 +680,8 @@ function hypermedia (server, req, rep, headers) {

uri = regex.scheme.test(obj[i]) ? obj[i] : `/${lcollection}/${obj[i]}`;

if (uri !== root && seen[uri] !== 1) {
seen[uri] = 1;
if (uri !== root && seen.has(uri) === false) {
seen.add(uri);

if (server.allowed("GET", uri, req.host) === true) {
rep.links.push({uri: uri, rel: lrel});
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is an elastic REST API gateway for node.js",
"version": "5.2.6",
"version": "5.2.7",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit cfa4b60

Please sign in to comment.