What exception should I throw to cause a 401 unauthorized response

If I want to perform some additional validation inside a hosted service method to validate the caller dynamically. What exception should I throw to cause the 401.

I can’t see a mapping in the docs between exceptions thrown and the http return code. If there is one can you point me at it?

Cheers

Not right now. There is an internal ticket which will enable you to force API Engine to return specific HTTP error codes.

Cool. Will I get notified when thats available.

Yes, we will update this topic.