Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions lib/api/2.0/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ var getBootstrap = controller( function (req, res) {
return tasksApiService.getBootstrap(req, res, req.swagger.params.macAddress.value);
});

var getTasksById = controller( {send204OnEmpty:true}, function (req){
var getTasksById = controller( function (req){
return tasksApiService.getTasks(req.swagger.params.identifier.value)
.catch(function (err) {
if (err.name === 'NoActiveTaskError') {
//Return with no data, this will cause a 204 to be sent
return;
}
// throw a NotFoundError
throw new Errors.NotFoundError('Not Found');
});
});
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/api/2.0/tasks-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ describe('Http.Api.Tasks', function () {
});
});

it("should return 204 if no active task exists", function() {
it("should return 404 if no active task exists", function() {
var tasksApiService = helper.injector.get('Http.Services.Api.Tasks');
taskProtocol.activeTaskExists.rejects(new tasksApiService.NoActiveTaskError());
return helper.request().get('/api/2.0/tasks/testnodeid')
.expect(204)
.expect(404)
.expect(function (res) {
expect(res.body).to.be.empty;
expect(res.body.message).to.deep.equal('Not Found');
});
});

Expand Down