forked from 00dani/lemoncurry
Add a Link header to the Micropub create response indicating the entry's shortlink
This commit is contained in:
parent
86f4da306c
commit
eb20cc1d21
1 changed files with 2 additions and 0 deletions
|
@ -73,6 +73,7 @@ def create(request):
|
||||||
|
|
||||||
base = utils.origin(request)
|
base = utils.origin(request)
|
||||||
perma = urljoin(base, entry.url)
|
perma = urljoin(base, entry.url)
|
||||||
|
short = urljoin(base, entry.short_url)
|
||||||
others = [urljoin(base, url) for url in (
|
others = [urljoin(base, url) for url in (
|
||||||
reverse('home:index'),
|
reverse('home:index'),
|
||||||
reverse('entries:atom'),
|
reverse('entries:atom'),
|
||||||
|
@ -86,4 +87,5 @@ def create(request):
|
||||||
|
|
||||||
res = HttpResponse(status=201)
|
res = HttpResponse(status=201)
|
||||||
res['Location'] = perma
|
res['Location'] = perma
|
||||||
|
res['Link'] = '<{}>; rel="shortlink"'.format(short)
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Reference in a new issue