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

Function image

httpbin/core.py:800–818  ·  view source on GitHub ↗

Returns a simple image of the type suggest by the Accept header.

()

Source from the content-addressed store, hash-verified

798
799@app.route('/image')
800def image():
801 """Returns a simple image of the type suggest by the Accept header."""
802
803 headers = get_headers()
804 if 'accept' not in headers:
805 return image_png() # Default media type to png
806
807 accept = headers['accept'].lower()
808
809 if 'image/webp' in accept:
810 return image_webp()
811 elif 'image/svg+xml' in accept:
812 return image_svg()
813 elif 'image/jpeg' in accept:
814 return image_jpeg()
815 elif 'image/png' in accept or 'image/*' in accept:
816 return image_png()
817 else:
818 return status_code(406) # Unsupported media type
819
820
821@app.route('/image/png')

Callers

nothing calls this directly

Calls 6

get_headersFunction · 0.85
image_pngFunction · 0.85
image_webpFunction · 0.85
image_svgFunction · 0.85
image_jpegFunction · 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…