Jun Jiang
Jun Jiang

Reputation: 97

Should GET requests be allowed to trigger exceptions?

I am developing a rest server. I am trying to add html injection check(sanitation) for all 4 actions. On error, I am planning to throw exception. I think Post, Put actions can throw exceptions but no sure if the GET and DELETE action can throw exception(from design perspective). The design docs requires return empty if the inputs contain sql/html injections. Throwing exceptions from GET action sounds wired. Thanks.

Upvotes: 0

Views: 73

Answers (1)

Leon
Leon

Reputation: 12491

With REST you should be returning correct Http status codes, not throwing exceptions.

Upvotes: 2

Related Questions