Reputation: 22616
I have the following case. The user need to be able to upload a spreadsheet (csv) but if there are errors (for example a value supposed to be a Integer is not a number) I need to display the full csv as a table with a red background on the invalid cell. I would like to set the status to 422, but I haven't find a way to do so. All the ways I found to set a status seems to "fail" the handler Monad and doesn't allow to specify a message body. I was expecting a setStatus or equivalent but I can't find it. Is there a way to do it, or is it against Http protocol do to so ?
Upvotes: 1
Views: 120
Reputation: 440
Probably you are looking for
sendResponseStatus :: (MonadHandler m, ToTypedContent c) => Status -> c -> m a
.
Upvotes: 2