Skip to content

Commit

Permalink
fix(static): always return entry path for 404 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed May 3, 2019
1 parent 82f628b commit 84fe876
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/openwhisk/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function error(message, code = 500) {
'Content-Type': 'text/html',
'X-Static': 'Raw/Static',
},
body: `Error ${code}: ${message}`,
body: `${message}`,
};
}

Expand Down Expand Up @@ -281,6 +281,9 @@ function deliverPlain(owner, repo, ref, entry, root, esi = false) {
body: entry,
};
}
if (rqerror.statusCode==404) {
return error(entry, rqerror.statusCode);
}
return error(rqerror.response.body.toString(), rqerror.statusCode);
});
}
Expand Down
2 changes: 1 addition & 1 deletion test/testStatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe('Static Delivery Action #unittest', () => {
it('error() #unittest', () => {
const error = index.error('Test');
assert.equal(error.statusCode, '500');
assert.ok(error.body.match('500'));
assert.ok(error.body.match('Test'));
assert.ok(!error.body.match('404'));
});

Expand Down

0 comments on commit 84fe876

Please sign in to comment.