You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.
And then, Inside my service class method I throw a Forbidden (401) if this value is not present:
consterrors=require('feathers-errors')// v2.9.1const_=require('underscore')classService{constructor(options){this.options=options||{}}asyncfind(params){if(_.isEmpty(params.authorizationHeader)){thrownewerrors.Forbidden('Access denied')// Was expecting a 401 response code but got 500}}}module.exports=function(options){returnnewService(options)}module.exports.Service=Service
I was hoping to be able to control the HTTP status code by using
feathers-errors
I have a middle-ware that places the
Authorization
header into the request object:And then, Inside my service class method I throw a Forbidden (401) if this value is not present:
The output looks like this:
But the status code is 500, not 401. And I would much prefer a json object in response, not HTML
The text was updated successfully, but these errors were encountered: