Opened 6 years ago
Closed 4 years ago
#39400 closed enhancement (wontfix)
Add filter for remote request URL
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | |
Component: | HTTP API | Keywords: | has-patch close 2nd-opinion reporter-feedback |
Focuses: | Cc: |
Description
Currently, I can filter an HTTP request's parameters, but not its URL.
I've run into several situations where this would be useful over the years, and it seems like others have as well.
There are a few workarounds, but they're inconvenient and ugly. This should be simple, and it seems like something developers just assume already exists.
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Personally I find it weird that we have the
http_request_args
filter, and don't really see adding ahttp_request_url
filter in addition to it a good idea.Filtering the URL requested is currently possible, but it's not as straightforward as some might expect - which is IMHO a good thing, as it also forces you to handle more of the actual request logic.
To filter the URL, you can hook into
pre_http_request
, match the URL, and then return the result of the request you'd like to make.For example:
Edit: I should note that this is more or less what's shown in one of your links; what the link doesn't show is how clean and straightforward the filter can be when used correctly.