reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

Expose `http::Uri` to layers passed to `ClientBuilder::connector_layer`

Open ivan770 opened this issue 5 months ago • 1 comments

Hi.

I'm currently trying to create a layer that performs some actions depending on the request URL. As the HTTP client itself is passed to different application components, I find it handy that connector_layer can serve as a single filtering entrypoint for all components.

For now, connector_layer is mostly limited to scenarios where access to the URL is not required (timeouts, concurrency limits, etc.), since a private, Unnameable type is passed to services as a request.

Would it be possible to expose the URL to external users? Even renaming Unnameable to LayerRequest and providing a method like fn url(&self) -> &http::Uri would be helpful, as the URL would be exposed only for reading.

ivan770 avatar Oct 20 '25 18:10 ivan770

Hm, that's an interesting idea! If there were some connect::ConnectorArgs (name might be terrible), then that would still allow us to potentially add other parts to it and still allow you to inspect it. 🤔

seanmonstar avatar Oct 20 '25 20:10 seanmonstar