CURL and clearing query after send |
Hi,
I'm using `curlrequest` but I found a problem. When we use a service `curlrequest` we could set an option for the client. For API which I'm trying to call auth is passed as a query params so I set options like this: PHP Code: $client = \Config\Services::curlrequest([ and everything works ok for the first request but next don't get that `query` option because it's cleared in `system/HTTP/CURLRequest.php:429`. It's this part of code: PHP Code: public function send(string $method, string $url) and I'm not sure if it's proper behavior?
What would happen if the options were not cleared and you wanted to do another request that was different from the previous one. In that case, you would need to clear out all the options and start again. This seems like a clean deterministic way of making sure no old options sneak through to subsequent queries.
What behaviour would you like to see and how would it work for all cases?
I think if someone sets a new `query` option then previously added query should be overridden. The second resolution of that problem could be a new property for setting a global `query` for the client.
For now, it is a bit problematic to pass these parameters to each curl request instead of passing the configured client. Edit: The best solution for that probably could be a new type for auth
I can see the value of having a global set of options and a per request set of options and then merging them into the curl request when it is executed.
That might be a good thing to mention in the Feature Request forum. |
Welcome Guest, Not a member yet? Register Sign In |