EP_API::format_request_headers PHP Method

format_request_headers() public method

Add appropriate request headers
Since: 1.4
public format_request_headers ( ) : array
return array
    public function format_request_headers()
    {
        $headers = array();
        // Check for ElasticPress API key and add to header if needed.
        if (defined('EP_API_KEY') && EP_API_KEY) {
            $headers['X-ElasticPress-API-Key'] = EP_API_KEY;
        }
        /**
         * ES Shield Username & Password
         * Adds username:password basic authentication headers
         *
         * Define the constant ES_SHIELD in your wp-config.php
         * Format: 'username:password' (colon separated)
         * Example: define( 'ES_SHIELD', 'es_admin:password' );
         *
         * @since 1.9
         */
        if (defined('ES_SHIELD') && ES_SHIELD) {
            $headers['Authorization'] = 'Basic ' . base64_encode(ES_SHIELD);
        }
        $headers = apply_filters('ep_format_request_headers', $headers);
        return $headers;
    }