Return 400 when update request is invalid
This commit is contained in:
@@ -26,6 +26,8 @@ module Micropub
|
||||
res.status = 200
|
||||
in Failure[:not_permitted]
|
||||
halt 401
|
||||
in Failure[:invalid_request]
|
||||
halt 400
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -13,6 +13,8 @@ module Micropub
|
||||
post = post_repo.fetch!(slug)
|
||||
|
||||
if params.key? :replace
|
||||
return Failure(:invalid_request) 400 unless params[:replace].is_a?(Hash)
|
||||
|
||||
content = params[:replace].delete(:content)
|
||||
content = content.is_a?(Array) ? content.first : content
|
||||
name = params[:replace].delete(:name)
|
||||
|
Reference in New Issue
Block a user