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

Allow content types text/xml and application/xml to be used interchangeably #173

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added

- `download_file` ([#122](https://github.com/stac-utils/stac-asset/pull/172))
- content type validation rule for `text/xml` and `application/xml` ([#173](https://github.com/stac-utils/stac-asset/pull/173))
gadomski marked this conversation as resolved.
Show resolved Hide resolved

## [0.3.2] - 2024-05-20

Expand Down
3 changes: 2 additions & 1 deletion src/stac_asset/validate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from .errors import ContentTypeError

ALLOWABLE_PAIRS = [
("image/tiff", "image/tiff; application=geotiff; profile=cloud-optimized")
("image/tiff", "image/tiff; application=geotiff; profile=cloud-optimized"),
("text/xml", "application/xml"),
]
IGNORED_CONTENT_TYPES = ["binary/octet-stream", "application/octet-stream"]

Expand Down
2 changes: 2 additions & 0 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ def test_content_type() -> None:
validate.content_type(
"image/tiff; application=geotiff; profile=cloud-optimized", "image/tiff"
)
validate.content_type("text/xml", "application/xml")
validate.content_type("application/xml", "text/xml")
gadomski marked this conversation as resolved.
Show resolved Hide resolved
validate.content_type("binary/octet-stream", "doesn't matter")
validate.content_type("application/octet-stream", "doesn't matter")