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

Please remove header() calls #10

Open
konforce opened this issue Jun 24, 2020 · 1 comment
Open

Please remove header() calls #10

konforce opened this issue Jun 24, 2020 · 1 comment

Comments

@konforce
Copy link

Thanks for the library. Works well, except the following lines cause issues for me:

// Helps with the CORS issues.
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: POST, GET' );
header( 'Access-Control-Allow-Credentials: true' );

If this library is invoked after output has already occurred, then this warning will appear:

Warning: Cannot modify header information - headers already sent by (...) in /app/vendor/ahmadawais/sendy-php-api/src/API.php

Obviously there are ways I could work around that, but given that this is a client API, it's not appropriate for it to force server headers on me. (These headers do absolutely nothing unless the Sendy server is setting them.) Also it's quite possible that this library is used via CLI where there is not even the concept of headers to send.

In the meantime I have removed these lines locally but I prefer to not need to use a modified version of the library.

@nachocifu
Copy link

nachocifu commented Oct 22, 2020

breaks with https://github.com/nelmio/NelmioCorsBundle

Forked and removed forced headers in https://github.com/RenuevaTuCloset/Sendy-PHP-API

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

2 participants