I have a servlet that reads from header.
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (isKeyPass(req.getHeader("externalApiKey"))) {
resp.sendError(SC_FORBIDDEN, "You do not have permission to access this page.");
return;
}
....
}
I want to be able to write a unit test to make a post request and get by 403 response. I am using servlet spec 3.0. I saw some response in .net but i am trying to do it in Java. What is the best way to do this.
Aucun commentaire:
Enregistrer un commentaire