Skip to content

Commit

Permalink
fix full test
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Sep 28, 2020
1 parent f4669da commit ad0686a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/full/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
* https://localhost:4000/api/math/div?a=25 <-- Throw validation error because `b` is missing
*
* - Authorization:
* https://localhost:4000/api/admin/~node/health <-- Throw `Unauthorized` because no `Authorization` header
* https://localhost:4000/api/admin/health <-- Throw `Unauthorized` because no `Authorization` header
*
* First you have to login . You will get a token and set it to the `Authorization` key in header
* https://localhost:4000/api/login?username=admin&password=admin
*
* Set the token to header and try again
* https://localhost:4000/api/admin/~node/health
* https://localhost:4000/api/admin/health
*
* - File upload:
* Open https://localhost:4000/upload.html in the browser and upload a file. The file will be placed to the "examples/full/uploads" folder.
Expand Down Expand Up @@ -364,7 +364,10 @@ broker.createService({
// Verify JWT token
return ctx.call("auth.resolveToken", { token })
.then(user => {
return Promise.reject(new UnAuthorizedError(ERR_NO_TOKEN));
if (!user)
return Promise.reject(new UnAuthorizedError(ERR_INVALID_TOKEN));

ctx.meta.user = user;
});
}
}
Expand Down

0 comments on commit ad0686a

Please sign in to comment.