Sample REST endpoint with non 200 response and no Exception
@RequestMapping("/{surveyId}") | |
public Survey findSurvey(@PathVariable String surveyId, HttpServletResponse response) { | |
log.info("Querying survey {}", surveyId); | |
Survey survey = repository.get(surveyId); | |
if (survey == null) { | |
log.warn("Survey {} was not found!", surveyId); | |
response.setStatus(404); | |
} | |
return survey; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment