Skip to content
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

Add support for CURLINFO_HEADER_OUT #261

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alnorth
Copy link
Contributor

@alnorth alnorth commented Nov 19, 2018

Context

When curl_setopt($ch, CURLINFO_HEADER_OUT, true) has been called before a request is sent you should then be able to call curl_getinfo($ch, CURLINFO_HEADER_OUT) after the request to get a description of the request that's been sent. Prior to this patch calling curl_getinfo($ch, CURLINFO_HEADER_OUT) with VCR enabled would actually cause an exception. To compound the issue the error message was also quite confusing (see #201 for an example).

What has been done

I've taken a second run at solving this as it was still causing problems for me with the PayPal SDK. My previous attempt was #198. I have similar misgivings about this version as it does break down some separation of concerns, but I think that's inevitable with this. The response object really does have to know about the request object.

This also required a function to format the Request as a string. I've mimicked curl's output for a simple GET request, but doing it for a POST with a body would take much more work. It's got enough there fulfil my purposes at the moment. It feels like the sort of thing that there may be a standard PHP function out there to do, but I haven't found one.

How to test

Unit tests have been added.

@alnorth alnorth changed the title Fix curlinfo header out Add support for CURLINFO_HEADER_OUT Nov 19, 2018
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.

None yet

1 participant