Set HTTP status code in Web Dev module

It is possible to have Web Dev endpoints return a status of 500 if the response dictionary doesn’t contain specific keys, or 404 if a desired file is not found. Is it possible to set the status arbitrarily in the do* script itself? For instance if the Gateway is acting as an actual gateway, and the resource server responds with an error.

See the note in the docs regarding request['servletResponse']. That provides direct access to the HttpServletResponse, where you can do pretty much anything you need. Be sure to return None from the doWhatever method.