mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 14:50:17 +00:00
Also send back Last-Modified and ETag
This commit is contained in:
+6
-1
@@ -11,10 +11,12 @@ import base64
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from flask import Flask, Response, request, render_template, redirect, jsonify, make_response
|
||||
from raven.contrib.flask import Sentry
|
||||
from werkzeug.datastructures import WWWAuthenticate
|
||||
from werkzeug.http import http_date
|
||||
|
||||
from . import filters
|
||||
from .helpers import get_headers, status_code, get_dict, check_basic_auth, check_digest_auth, H, ROBOT_TXT, ANGRY_ASCII
|
||||
@@ -336,7 +338,10 @@ def cache():
|
||||
is_conditional = request.headers.get('If-Modified-Since') or request.headers.get('If-None-Match')
|
||||
|
||||
if is_conditional is None:
|
||||
return view_get()
|
||||
response = view_get()
|
||||
response.headers['Last-Modified'] = http_date()
|
||||
response.headers['ETag'] = uuid.uuid4().hex
|
||||
return response
|
||||
else:
|
||||
return status_code(304)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user