Skip to content

Instantly share code, notes, and snippets.

@glaforge
Created November 14, 2022 10:52
Show Gist options
  • Save glaforge/67dcb8a9cea40fa192233daa497e30ee to your computer and use it in GitHub Desktop.
Save glaforge/67dcb8a9cea40fa192233daa497e30ee to your computer and use it in GitHub Desktop.
@Controller("/product")
public class ProductController {
@Get
@Status(HttpStatus.OK)
public void index() {
throw Problem.builder()
.withType(URI.create("https://example.org/out-of-stock"))
.withTitle("Out of Stock")
.withStatus(new HttpStatusType(HttpStatus.BAD_REQUEST))
.withDetail("Item B00027Y5QG is no longer available")
.with("product", "B00027Y5QG")
.build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment