Skip to content

Make HTML output optional - #260

Merged
jampukka merged 2 commits into
mainfrom
fix/257-html-optional
Nov 30, 2026
Merged

jampukka merged 2 commits into
mainfrom
fix/257-html-optional

Conversation

@jampukka

Copy link
Copy Markdown
Collaborator

Fixes #257.

Without a formats setting no HTML writer is registered, yet HTML was still advertised and chosen for Accept: text/html → HTTP 500 MessageBodyWriter not found ... HTMLContext<Root>.

  • Metadata formats derived from registered output formats (JSON always included).
  • COMMON_HTML/HTML conformance, landing page links and OpenAPI media types only when HTML is served.
  • GlobalFQueryParamFilter: strips text/html from Accept (wildcard prefers JSON); f=html → 400 when disabled.
  • Tests: HtmlDisabledTest; CollectionlessServiceTest updated (no HTML conformance without formats).

Verified in Docker (addresses example with formats removed): landing page with browser Accept returns JSON, items return application/geo+json, no HTML in conformance/OpenAPI, no writer errors in logs. Remaining 4 test failures (GoldenDocumentTest x3, OpenApiLangParamTest) also fail on main.

Without a formats setting no HTML writer is registered, but HTML was still
advertised and selected for Accept: text/html, causing HTTP 500. Metadata
formats now follow the registered output formats; conformance, links, f values
and OpenAPI only advertise what is served. Fixes #257.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jampukka jampukka changed the title Make HTML output optional (fixes #257) Make HTML output optional Nov 30, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jampukka jampukka added this to the 2.2.0 milestone Nov 30, 2026
@jampukka
jampukka merged commit a813cb9 into main Nov 30, 2026
2 checks passed
@jampukka
jampukka deleted the fix/257-html-optional branch November 30, 2026 14:08
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.

Ensure that HTML output can be disabled in Hakunapi configuration

1 participant