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

Custom Headers #20

Closed
o-data opened this issue Jul 20, 2020 · 1 comment
Closed

Custom Headers #20

o-data opened this issue Jul 20, 2020 · 1 comment

Comments

@o-data
Copy link

o-data commented Jul 20, 2020

Re: https://wordpress.org/support/topic/custom-headers-12/

Hi kennym,

How to add Custom Headers? The thread was resolves but there was not guide to doing that.

Thank you.

@o-data
Copy link
Author

o-data commented Jul 22, 2020

Hi guys,

Good news, I figured out how to do it since there were no response. Here is the guide to add your custom headers.

Go to your file manager (or make these edit before uploading to your Wordpress website). Assuming it is uploaded then make the edit to this file (this guide is applicable to version 1.4.6 only, I think it general work for all version).

\wp-content\plugins\cf7-to-api-basic-auth\includes\class-cf7-api-admin.php

Around lines 561 you should see this code:

      if( $record_type == "json" ){

        $args['headers']['Content-Type'] = 'application/json';

Now I want to add another custom headers in here, I would change from up to this:


      if( $record_type == "json" ){

        $args['headers']['Content-Type'] = 'application/json';
        $args['headers']['Accept'] = 'application/json';

Save file, do a test and see if it work. For me it did because my server require that "Accept" header.

I close this now since issue is resolve.

@o-data o-data closed this as completed Jul 22, 2020
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