Fix response code for post creation

This commit is contained in:
2024-02-24 09:15:13 +11:00
parent c57cb62917
commit 13577aa538

View File

@@ -31,10 +31,10 @@ module Micropub
# create # create
if req_entity && verify_scope(req: req, scope: :create) if req_entity && verify_scope(req: req, scope: :create)
create_entry.call(req_entity: req_entity) do |m| Dry::Matcher::ResultMatcher.(create_entry.call(req_entity: req_entity)) do |m|
m.success do |post| m.success do |post|
res.headers["Location"] = "#{settings.micropub_site_url}/#{post.value!.post_type}/#{post.value!.slug}"
res.status = 201 res.status = 201
res.headers["Location"] = "#{settings.micropub_site_url}/#{post.post_type}/#{post.slug}"
end end
m.failure do |validation| m.failure do |validation|