Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing request params to a source #929

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

walkermatt
Copy link
Contributor

We (@AstunTechnology) have a requirement to pass an API key through MapProxy onto a WMTS source with the response being cached. Unlike dimensions the API key should not be taken into account when caching, resulting in all users benefiting from a short-term cache.

This PR adds the concept of extra_params which are those request parameters that are not part of a standard request. The extra_params are available to WMS and tile sources for inclusion in source requests. To include a parameter from extra_params in a WMS source request the forward_req_params property is set to a list of required parameter names; for a tile source a placeholder is defined in the URL.

Existing tests have been updated to take into account this new functionality.

A use case for passing a request parameter to the source is passing an
API key thorough MapProxy onto a source with the response being cached.
Unlike dimensions, these parameters are not taken into account when
caching.

Adds the concept of extra_params which are those request parameters that
are not part of a standard request. The extra_params are available to
WMS and tile sources for inclusion in source requests.

To include an extra_params in a WMS source request the
forward_req_params property is set to a list of parameter names; for a
tile source a placeholder is defined in the URL.

Existing tests have been updated to take into account this new
functionality.
The system/test_wmts.py::TestWMTS::test_get_tile_flipped_axis test
doesn't rely on the contents of test/system/fixture/cache_data being
copied into it's newly created cache_dir so remove the fixture from the
test.

The test asserts that the cache_data/tile_locks directory does not exist
as a prerequisite, I ran into an issue where I had been debugging tests
by running `mapproxy-util serve-develop` against a config file under
system/fixture which resulted in a tile_locks directory being created;
this caused the test_get_tile_flipped_axis to fail unexpectedly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant