Skip to content

Support opt-in strict content negotiation - #2395

Draft
joao-jtjsoftware wants to merge 1 commit into
geopython:masterfrom
joao-jtjsoftware:fix-2374-strict-content-negotiation
Draft

Support opt-in strict content negotiation#2395
joao-jtjsoftware wants to merge 1 commit into
geopython:masterfrom
joao-jtjsoftware:fix-2374-strict-content-negotiation

Conversation

@joao-jtjsoftware

Copy link
Copy Markdown

Summary

  • add opt-in strict HTTP content negotiation through server.api_rules.strict_content_negotiation
  • return 406 Not Acceptable for unsupported Accept media types in strict mode
  • preserve the existing default representation fallback when strict mode is disabled
  • support / and type wildcards such as image/*
  • apply the setting consistently to Flask, Starlette and Django
  • document and validate the new configuration option

Behaviour

The option defaults to false, so existing deployments retain their current behaviour. Invalid ?f= values continue to return 400 InvalidParameterValue.

Tests

  • pytest tests/other/test_config.py tests/api/test_api.py::test_apirequest tests/api/test_api.py::test_apirules_active tests/api/test_api.py::test_apirules_inactive -q
  • flake8 --jobs 1 pygeoapi tests/api/test_api.py
  • git diff --check

All targeted checks pass.

Related to #2374. This is a draft pending agreement on the opt-in approach discussed in the issue.

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