From eb20cc1d21cc839f3296c513893d8b324d194592 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Thu, 10 May 2018 13:42:59 +1000 Subject: [PATCH] Add a Link header to the Micropub create response indicating the entry's shortlink --- micropub/views/create.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/micropub/views/create.py b/micropub/views/create.py index ef3599d..082bd4c 100644 --- a/micropub/views/create.py +++ b/micropub/views/create.py @@ -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