Skip to content

Please remove header() calls #10

Open
@konforce

Description

@konforce

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions