Fix status code
This commit is contained in:
@@ -22,12 +22,13 @@ module Micropub
|
|||||||
if action_type
|
if action_type
|
||||||
case resolve_command(req: req, action_type: action_type)
|
case resolve_command(req: req, action_type: action_type)
|
||||||
in Success[command]
|
in Success[command]
|
||||||
command.call(params: req.params.to_h)
|
if command.call(params: req.params.to_h).success?
|
||||||
res.status = 200
|
res.status = 200
|
||||||
|
else
|
||||||
|
halt 400
|
||||||
|
end
|
||||||
in Failure[:not_permitted]
|
in Failure[:not_permitted]
|
||||||
halt 401
|
halt 401
|
||||||
in Failure[:invalid_request]
|
|
||||||
halt 400
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ module Micropub
|
|||||||
post = post_repo.fetch!(slug)
|
post = post_repo.fetch!(slug)
|
||||||
|
|
||||||
if params.key? :replace
|
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 = params[:replace].delete(:content)
|
||||||
content = content.is_a?(Array) ? content.first : content
|
content = content.is_a?(Array) ? content.first : content
|
||||||
|
Reference in New Issue
Block a user