Skip to content

Expose configured base URL on Builder (closes #128) - #240

Open
gghez wants to merge 1 commit into
rust-ammonia:masterfrom
gghez:worktree-issue-128-expose-base-url
Open

Expose configured base URL on Builder (closes #128)#240
gghez wants to merge 1 commit into
rust-ammonia:masterfrom
gghez:worktree-issue-128-expose-base-url

Conversation

@gghez

@gghez gghez commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds three small introspection methods on Builder that mirror the existing is_url_relative_deny / is_url_relative_pass_through / is_url_relative_custom pattern, so callers can inspect (or recover) the relative-URL configuration without re-deriving it:

  • is_url_relative_rewrite_with_base() -> bool
  • is_url_relative_rewrite_with_root() -> bool
  • url_relative_base() -> Option<&Url> — returns the base Url when UrlRelative::RewriteWithBase is configured

This addresses the "expose a function returning the set base value or none" half of #128. No behavior change for existing users; only new public accessors.

Test plan

  • cargo test (all unit + doc tests pass, including the three new doctests)
  • Clippy reports no new warnings relative to master

Adds three Builder accessors that mirror the existing
is_url_relative_deny / is_url_relative_pass_through / is_url_relative_custom
introspection methods so callers can inspect the relative-URL
configuration without re-deriving it:

* is_url_relative_rewrite_with_base
* is_url_relative_rewrite_with_root
* url_relative_base -> Option<&Url>

Closes rust-ammonia#128.
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