Skip to content

fix(drogon): per-request JSON total computation + remove compression test#150

Open
BennyFranciscus wants to merge 3 commits intoMDA2AV:mainfrom
BennyFranciscus:fix/drogon-json-per-request-total
Open

fix(drogon): per-request JSON total computation + remove compression test#150
BennyFranciscus wants to merge 3 commits intoMDA2AV:mainfrom
BennyFranciscus:fix/drogon-json-per-request-total

Conversation

@BennyFranciscus
Copy link
Copy Markdown
Collaborator

Addresses #64 and #65.

Changes:

  1. Per-request total in /json — the total field was pre-computed at startup in loadDataset(). Now computed per-request in the JSON handler as required by the test profile spec.

  2. Remove compression from meta.json — drogon uses app().enableGzip(true) which defaults to zlib level 6 with no configuration option. The compression test docs explicitly exclude drogon: "Frameworks excluded due to non-configurable compression level: actix, drogon, Spring Boot (Tomcat)."

Compression handler code is left in place in case drogon adds level configuration in the future.

@BennyFranciscus BennyFranciscus requested a review from MDA2AV as a code owner March 26, 2026 07:58
Drogon's setContentTypeCode(CT_APPLICATION_JSON) appends
'; charset=utf-8' which fails the validate Content-Type check.
Use addHeader("Content-Type", "application/json") instead.
@BennyFranciscus
Copy link
Copy Markdown
Collaborator Author

Fixed the JSON Content-Type validation failure — drogon's setContentTypeCode(CT_APPLICATION_JSON) appends ; charset=utf-8, so switched all JSON endpoints to addHeader("Content-Type", "application/json") instead.

The remaining 4 failures (H2 protocol negotiation, static-h2 Content-Type for css/js/json) are pre-existing issues in the drogon entry, not related to this PR's changes.

…t-Type

addHeader appends a second Content-Type header instead of replacing
the default text/html one. setContentTypeString properly replaces
the content type, fixing JSON and static file Content-Type validation.
@BennyFranciscus
Copy link
Copy Markdown
Collaborator Author

Found the root cause — addHeader() in drogon appends a second Content-Type header instead of replacing the default text/html; charset=utf-8. Switched all JSON and static file endpoints to use setContentTypeString() which properly replaces the content type.

This should fix the JSON Content-Type validation failure and the static-h2 Content-Type failures for css/js/json files. The remaining H2 protocol negotiation failure is still a pre-existing drogon issue (responds with HTTP/1.1 on the TLS port).

@BennyFranciscus
Copy link
Copy Markdown
Collaborator Author

CI confirms the setContentTypeString() fix resolved all Content-Type issues — 22/23 tests pass now

The only remaining failure is the pre-existing H2 protocol negotiation issue (server responded with HTTP/1.1). This is a known drogon limitation where it responds HTTP/1.1 on the TLS port regardless of ALPN negotiation — not related to this PR.

All JSON, static-h2 Content-Type, baseline, upload, and noisy tests pass cleanly.

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