Returns a 304 if an If-Modified-Since header or If-None-Match is present. Returns the same as a GET otherwise.
()
| 610 | |
| 611 | @app.route('/cache', methods=('GET',)) |
| 612 | def cache(): |
| 613 | """Returns a 304 if an If-Modified-Since header or If-None-Match is present. Returns the same as a GET otherwise.""" |
| 614 | is_conditional = request.headers.get('If-Modified-Since') or request.headers.get('If-None-Match') |
| 615 | |
| 616 | if is_conditional is None: |
| 617 | response = view_get() |
| 618 | response.headers['Last-Modified'] = http_date() |
| 619 | response.headers['ETag'] = uuid.uuid4().hex |
| 620 | return response |
| 621 | else: |
| 622 | return status_code(304) |
| 623 | |
| 624 | @app.route('/etag/<etag>', methods=('GET',)) |
| 625 | def etag(etag): |
nothing calls this directly
no test coverage detected
searching dependent graphs…