Add a Link header to the Micropub create response indicating the entry's shortlink

This commit is contained in:
Danielle McLean 2018-05-10 13:42:59 +10:00
父節點 86f4da306c
當前提交 eb20cc1d21
簽署人: 00dani
GPG Key ID: D111F8C5A2560F19
共有 1 個文件被更改,包括 2 次插入0 次删除

查看文件

@ -73,6 +73,7 @@ def create(request):
base = utils.origin(request)
perma = urljoin(base, entry.url)
short = urljoin(base, entry.short_url)
others = [urljoin(base, url) for url in (
reverse('home:index'),
reverse('entries:atom'),
@ -86,4 +87,5 @@ def create(request):
res = HttpResponse(status=201)
res['Location'] = perma
res['Link'] = '<{}>; rel="shortlink"'.format(short)
return res