http-rs / surf

Fast and friendly HTTP client framework for async Rust
https://docs.rs/surf
Apache License 2.0
1.45k stars 119 forks source link

Support requiring requests to go to the configured base URL's origin #343

Open joshtriplett opened 2 years ago

joshtriplett commented 2 years ago

Add Config::set_mandatory_base_origin() to enable this behavior. Useful if the Config includes authentication headers or similar.

Fishrock123 commented 2 years ago

Should this be a cargo option? Or do you think it's better on Config like you have in this PR?

joshtriplett commented 2 years ago

@Fishrock123 I definitely don't think it should be a cargo feature; that'd be backwards-incompatible for anyone not expecting that behavior, including other users elsewhere in the dependency tree that didn't set that feature.

I think it makes sense to set this on a config-by-config basis.