mirror of
https://github.com/danbee/micropub.git
synced 2025-03-04 08:59:13 +00:00
Return Location header
This commit is contained in:
parent
0b97673fe0
commit
327cd81de7
@ -5,6 +5,10 @@ class Post
|
|||||||
@params = params
|
@params = params
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def path
|
||||||
|
"/blog/#{published.strftime("%Y/%m/%d")}/#{id}"
|
||||||
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
title.
|
title.
|
||||||
downcase.
|
downcase.
|
||||||
@ -22,7 +26,7 @@ class Post
|
|||||||
split(" ").
|
split(" ").
|
||||||
take(6).
|
take(6).
|
||||||
join(" ").
|
join(" ").
|
||||||
gsub(/([a-z])$/, "\1…")
|
gsub(/([a-z])$/, "\\1…")
|
||||||
end
|
end
|
||||||
|
|
||||||
def published
|
def published
|
||||||
|
|||||||
@ -28,7 +28,8 @@ module Micropub
|
|||||||
post = Post.new(params)
|
post = Post.new(params)
|
||||||
|
|
||||||
if github.post!(post)
|
if github.post!(post)
|
||||||
status 201
|
headers "Location" => post.path
|
||||||
|
status 202
|
||||||
else
|
else
|
||||||
status 400
|
status 400
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user