Returns a simple image of the type suggest by the Accept header.
()
| 798 | |
| 799 | @app.route('/image') |
| 800 | def 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') |
nothing calls this directly
no test coverage detected
searching dependent graphs…