Skip to content

Return HTTP 413 if response exceeds configured MAXIMUM_BYTES_RETURNED#46

Open
nuwanwre wants to merge 5 commits intoEIDA:masterfrom
nuwanwre:fix-payload-limit
Open

Return HTTP 413 if response exceeds configured MAXIMUM_BYTES_RETURNED#46
nuwanwre wants to merge 5 commits intoEIDA:masterfrom
nuwanwre:fix-payload-limit

Conversation

@nuwanwre
Copy link

@nuwanwre nuwanwre commented Feb 20, 2026

Addresses #39 and #43 where responses were abruptly cut-off.

Changes proposed here does 2 things,

  1. Gets rid of streaming when configured MAXIMUM_BYTES_RETURNED > 0.
    This enables the service to build the response before sending a HTTP response to the consumer. Previous implementation starts streaming data right away starting with a HTTP 200 response, and it's not possible to return HTTP 413 later on.
    Note: This could result in memory spikes.

  2. MAXIMUM_BYTES_RETURNED = 0 will still allow streaming and avoid memory spikes.
    Note: Please refer to MongoDB limitations on open cursor and maximum document size that can be returned.

Example query (with MAXIMUM_BYTES_RETURNED = 10e3 for demonstration),

$ curl --request GET \
  --url 'http://localhost:3000/eidaws/wfcatalog/1/query?network=NL&station=G233&include=sample&start=2024-01-01&end=2024-01-31'

Error 413: Payload Too Large
The requested payload exceeds the service limitation
Usage details are available from ENTER_URI_HERE
Request:
/eidaws/wfcatalog/1/query?network=NL&station=G233&include=sample&start=2024-01-01&end=2024-01-31
Request Submitted:
Fri Feb 20 2026 09:01:37 GMT+0100 (Midden-Europese standaardtijd)
Service Version:
1.0.3

Other explored solutions

  1. Pagination: Ideally, it would be great if the responses could be paginated. This will allow consumers to incrementally query the API/Database providing a much pleasant experience. However, this requires considerable overhaul of the current API design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant