mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
set vary headers #57
This commit is contained in:
parent
eba9ec8bd6
commit
fffb58fb07
3 changed files with 6 additions and 4 deletions
|
@ -1055,7 +1055,7 @@ def comment_ap(comment_id):
|
||||||
}
|
}
|
||||||
resp = jsonify(reply_data)
|
resp = jsonify(reply_data)
|
||||||
resp.content_type = 'application/activity+json'
|
resp.content_type = 'application/activity+json'
|
||||||
resp.headers.set('Vary', 'Accept, Cookie')
|
resp.headers.set('Vary', 'Accept, Accept-Encoding, Cookie')
|
||||||
return resp
|
return resp
|
||||||
else:
|
else:
|
||||||
reply = PostReply.query.get_or_404(comment_id)
|
reply = PostReply.query.get_or_404(comment_id)
|
||||||
|
@ -1076,7 +1076,7 @@ def post_ap(post_id):
|
||||||
post_data['@context'] = default_context()
|
post_data['@context'] = default_context()
|
||||||
resp = jsonify(post_data)
|
resp = jsonify(post_data)
|
||||||
resp.content_type = 'application/activity+json'
|
resp.content_type = 'application/activity+json'
|
||||||
resp.headers.set('Vary', 'Accept, Cookie')
|
resp.headers.set('Vary', 'Accept, Accept-Encoding, Cookie')
|
||||||
return resp
|
return resp
|
||||||
else:
|
else:
|
||||||
return show_post(post_id)
|
return show_post(post_id)
|
||||||
|
|
|
@ -182,7 +182,7 @@ def show_post(post_id: int):
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
||||||
)
|
)
|
||||||
response.headers.set('Vary', 'Accept, Cookie')
|
response.headers.set('Vary', 'Accept, Accept-Encoding, Cookie')
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -374,7 +374,8 @@ def continue_discussion(post_id, comment_id):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()), community=post.community,
|
joined_communities=joined_communities(current_user.get_id()), community=post.community,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)])
|
inoculation=inoculation[randint(0, len(inoculation) - 1)])
|
||||||
return response.headers.set('Vary', 'Accept, Cookie')
|
response.headers.set('Vary', 'Accept, Accept-Encoding, Cookie')
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/comment/<int:comment_id>/reply', methods=['GET', 'POST'])
|
@bp.route('/post/<int:post_id>/comment/<int:comment_id>/reply', methods=['GET', 'POST'])
|
||||||
|
|
|
@ -57,6 +57,7 @@ def return_304(etag, content_type=None):
|
||||||
resp = make_response('', 304)
|
resp = make_response('', 304)
|
||||||
resp.headers.add_header('ETag', request.headers['If-None-Match'])
|
resp.headers.add_header('ETag', request.headers['If-None-Match'])
|
||||||
resp.headers.add_header('Cache-Control', 'no-cache, max-age=600, must-revalidate')
|
resp.headers.add_header('Cache-Control', 'no-cache, max-age=600, must-revalidate')
|
||||||
|
resp.headers.add_header('Vary', 'Accept, Accept-Encoding, Cookie')
|
||||||
if content_type:
|
if content_type:
|
||||||
resp.headers.set('Content-Type', content_type)
|
resp.headers.set('Content-Type', content_type)
|
||||||
return resp
|
return resp
|
||||||
|
|
Loading…
Add table
Reference in a new issue