Fix status code

This commit is contained in:
2024-02-24 16:30:51 +11:00
parent 45221e653d
commit 80845c9cf0
2 changed files with 6 additions and 5 deletions

View File

@@ -22,12 +22,13 @@ module Micropub
if action_type
case resolve_command(req: req, action_type: action_type)
in Success[command]
command.call(params: req.params.to_h)
if command.call(params: req.params.to_h).success?
res.status = 200
else
halt 400
end
in Failure[:not_permitted]
halt 401
in Failure[:invalid_request]
halt 400
end
end

View File

@@ -13,7 +13,7 @@ module Micropub
post = post_repo.fetch!(slug)
if params.key? :replace
return Failure(:invalid_request) 400 unless params[:replace].is_a?(Hash)
return Failure(:invalid_request) unless params[:replace].is_a?(Hash)
content = params[:replace].delete(:content)
content = content.is_a?(Array) ? content.first : content