MCPcopy
hub / github.com/postmanlabs/httpbin / cache

Function cache

httpbin/core.py:612–622  ·  view source on GitHub ↗

Returns a 304 if an If-Modified-Since header or If-None-Match is present. Returns the same as a GET otherwise.

()

Source from the content-addressed store, hash-verified

610
611@app.route('/cache', methods=('GET',))
612def 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',))
625def etag(etag):

Callers

nothing calls this directly

Calls 2

view_getFunction · 0.85
status_codeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…