Skip to content

Commit c989cbd

Browse files
committed
Replaced 404 response with 204 (empty)
For subscriptions that do not yet exist, return a 204 `NO CONTENT` response instead of a 404 `NOT FOUND`. Backbone handles empty reponses correctly, and the 204 code will not trigger a jQuery `ajaxError` event.
1 parent e6f6bc3 commit c989cbd

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

code_comments/subscription.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,7 @@ def filter_stream(self, req, method, filename, stream, data):
481481
def _do_GET(self, req):
482482
subscription = Subscription.for_request(self.env, req)
483483
if subscription is None:
484-
raise HTTPNotFound('Subscription to /%s%s for %s not found',
485-
req.args.get('realm'), req.args.get('path'),
486-
req.authname)
484+
req.send('', 'application/json', 204)
487485
req.send(json.dumps(subscription, cls=SubscriptionJSONEncoder),
488486
'application/json')
489487

0 commit comments

Comments
 (0)