Skip to content

Binary Endpoints #1462

Closed
Closed
@pkel

Description

@pkel

I tried to setup an endpoint for providing binary data. My main motivation is to serve images for <img> tags without javascript. I documented my progress in a PR on the documentation repo.

There is one remaining issue. The raw-media-types option is not powerful enough to provide a transparent binary endpoint that behaves like a webserver serving files. Firefox sends

Accept: image/webp,*/*

on <img> requests and

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

on navigation requests (e.g. user does right click view image).

I tried the following settings:

  • */*. Navigation requests for regular json endpoints fail with */* requested but more than one column was selected.
  • image/webp. Same problem.
  • image/*. Does not work for <img> requests.

From my unprivileged point of view, I see two ways forward:

  1. A raw-media-endpoint configuration option that triggers raw output for the specified tables, views, and procedures.
  2. A local parameter response.raw that allows to trigger raw output for a single request with something like perform set_config('response.raw', 'true', true);.

The second variant can emulate the first via pre-request. The first would suffice for my use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa feature, ready for implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions