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 flag to include additional request/response data in stripe api calls #42

Open
redtopia opened this issue Feb 2, 2022 · 0 comments

Comments

@redtopia
Copy link

redtopia commented Feb 2, 2022

While debugging, I have had the need to see the headers and other data used for the Stripe API request. It would be nice to either always include this data, or add a flag to the stripe.call() method to allow some raw request data to be sent back to the caller. What I did is modified the .call() method as follows:

        var rawResponse = httpService.makeRequest(
            methodMetadata.httpmethod,
            path,
            headerData.headers,
            params,
            methodMetadata.multipart
        );

        var response = { };

	response[ 'http' ] = {
		'path': path,
		'headerData': headerData,
		'params': params,
		'rawResponse': rawResponse,
		'methodMetadata': methodMetadata,
	};

However, in the case of an exception, I wouldn't see this because the .call() method doesn't catch exceptions and if one occurs, there would be no response struct being returned. Personally, I think it would be better for the .call() method to catch exceptions and therefore would always return a struct that would include the error information if an exception was thrown. That being said, I understand that could break existing applications so I'm not making that request.

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

No branches or pull requests

1 participant