Skip to content

Conversation

@mean-cj
Copy link
Contributor

@mean-cj mean-cj commented May 18, 2022

No description provided.

@nadar
Copy link
Member

nadar commented Jul 29, 2022

Hi @mean-cj

Whats to benefit of introducing this? What does it change? Could you please elaborate?

@mean-cj
Copy link
Contributor Author

mean-cj commented Jul 29, 2022

Hi nada

When we need to call $curl->get() after $curl->post() ,
curl option "CURLOPT_CUSTOMREQUEST" doesn't work because curl option remember CURLOPT_CUSTOMREQUEST = POST

fixed
add $this->setOpt(CURLOPT_CUSTOMREQUEST, "GET"); into the get method.

@nadar nadar requested review from amouhzi and nadar July 29, 2022 09:21
Copy link
Member

@nadar nadar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then you should create two objects any how. That old code design of this project is somewhat outdated and the response should be immutable or stored in separate object, but its not. So i would recommend:

$get = (new Curl())->get(...)
$post = (new Curl())->post(...)

But since we set customrequest also for put, patch, delete, this looks good to me.

@nadar
Copy link
Member

nadar commented Aug 29, 2022

When you change the request method by setting CURLOPT_CUSTOMREQUEST to something, you do not actually change how libcurl behaves or acts in regards to the particular request method, it will only change the actual string sent in the request.

@nadar nadar merged commit 7e506d8 into php-mod:master Aug 29, 2022
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.

2 participants