-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manage "Expect" header with cURL transport #454
Conversation
I'm not sure how you prefer to handle the |
@carlalexander Thanks for finding this and for the PR! Do you think this could be covered by unit tests in some way ?
For code readability and comprehension, I'd much prefer it if it would be pulled apart and calculated before the Also, for the multi-line comment, you may want to use multi-comment style |
Normally, I do multi-line comments that way too. I'm just trying to keep the same coding style as the one below. Happy to switch it to the I can also create a function to get the get the For testing, I'd like to add tests. I just didn't really see anything for testing cURL code. The cURL transport has 4 tests to check for some thrown exceptions. That's it. Did you have something in mind for testing it? Normally, I use a testing library to mock PHP functions. But I don't think that will work here since there's no namespace. |
I see where your confusion comes from. Most of the tests for the cURL code are in the If you run the tests with |
I hear you. We've cleaned up the code style recently, cleaning up the comments is on the to do list still, ;-) |
Alright, I'll take a look at adding tests over the weekend. I've done another pass and fixed up the comment and moved the |
Alright, so I've tried to write some tests, but the Heroku application that we run tests against doesn't seem to return the Is the code for that Heroku application anywhere? Also it could be that Heroku strips the header. |
@carlalexander I'm not sure at all, but I suspect it might be this repo: https://github.com/rmccue/httpbin @rmccue Ryan, could you please confirm ? (or point to the real source) |
Yeah, I'm trying against |
I think the source of the server is this one: https://github.com/RequestsPHP/test-server |
That's the one, yep :) |
@carlalexander Just checking in - will you have time to update the PR for the tests ? And if so, what timeline are we looking at ? |
@jrfnl Hoping to sit down and hammer at it some more this weekend. 😄 I haven't looked at it this week. |
Ok, so I have some tests running, but they only work with @rmccue's server. I'm just running it locally atm. Are there tests that use it? It seems everything uses httpbin.org and it doesn't return the header. Another good news is you can clearly see the 1 sec timeout with the tests. So that's great. |
@carlalexander I hope I understood your question correctly, but AFAICS, all tests which use a function call to Also see #315 for some additional context. |
011baa6
to
98eb7a6
Compare
Codecov Report
@@ Coverage Diff @@
## master #454 +/- ##
============================================
- Coverage 93.06% 93.05% -0.01%
- Complexity 763 771 +8
============================================
Files 21 21
Lines 1788 1800 +12
============================================
+ Hits 1664 1675 +11
- Misses 124 125 +1
Continue to review full report at Codecov.
|
Ok, this helped @jrfnl! I tried with |
@carlalexander Awesome! I'll have a more detailed look soon. What about annotating the tests with the performance fix with |
@carlalexander Was just looking at Travis and I noticed there does still seem to be an issue:
|
bdc1053
to
11df650
Compare
@jrfnl That's my bad. I was using the new function signature for |
Ok, well the old signature makes |
There is no "new" function signature. There is a cross-version compatible signature and a second signature which was previously supported, but isn't anymore. The function should be called like so:
And rightfully so as using the reverse order will throw a deprecation notice on PHP 7.4 (and fail the tests because of it) and be a fatal error on PHP 8.0. |
Yeah, I'm reverting the change. I understand what's going on now. I'm also going to add some more tests. |
@carlalexander Appreciated! You're a ⭐ |
7031301
to
7b32a7b
Compare
Everything is green except for PHP 8.0. It doesn't seem to be an issue with the tests or code. It seems to be PHPUnit related. |
Correct - see #439 |
Perfect, should be good to merge once you've done your review. Let me know if you need anything else 😄 |
Pushed @schlessera's recommended changes 😄 |
Really great suggestion @TimothyBJacobs! I've reworked the method to early return if we hit the 1MB limit. |
Dammit! I broke the PR when I wanted to do a rebase. When will I learn not to touch PRs that were done directly in @carlalexander Are you able to push the change again rebased on latest |
I recreated the PR here: #469 |
Fixes #453