Skip to content

Commit

Permalink
Merge pull request #314 from razee-io/403_to_404
Browse files Browse the repository at this point in the history
change 403 to 404 on get of /api/v2/clusters/:id
  • Loading branch information
dalehille authored Apr 29, 2020
2 parents 23dbd37 + 13acc0a commit c0584cb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
"200": {
"description": "Cluster resources removed"
},
"403": {
"404": {
"description": "Cluster not found"
},
"500": {
Expand Down
2 changes: 1 addition & 1 deletion app/utils/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const getCluster = async (req, res, next) => {
const Clusters = req.db.collection('clusters');
const cluster = await Clusters.findOne({ org_id: req.org._id, cluster_id: cluster_id });
if (!cluster) {
res.status(403).send(`Cluster ${cluster_id} not found`);
res.status(404).send(`Cluster ${cluster_id} not found`);
return;
}
req.cluster = cluster; // eslint-disable-line require-atomic-updates
Expand Down
4 changes: 2 additions & 2 deletions app/utils/cluster.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('utils', () => {
assert.equal(response.statusCode, 401);
});

it('should return 403 if cannot find cluster', async () => {
it('should return 404 if cannot find cluster', async () => {
// Setup
var request = httpMocks.createRequest({
method: 'POST',
Expand Down Expand Up @@ -140,7 +140,7 @@ describe('utils', () => {

assert.equal(nextCalled, false);

assert.equal(response.statusCode, 403);
assert.equal(response.statusCode, 404);
});

it('should call next', async () => {
Expand Down

0 comments on commit c0584cb

Please sign in to comment.