Automator_Send_Webhook::get_content_type( $data_type, $headers )
Outgoing webhook Content Type
Return Return
(string|array)
Source Source
File: src/core/lib/webhooks/class-automator-send-webhook.php
public function get_content_type( $data_type, $headers ) { $supported_data_types = array( 'application/x-www-form-urlencoded' => 'x-www-form-urlencoded', 'multipart/form-data' => 'form-data', 'application/json' => 'json', 'text/plain' => 'plain', 'application/binary' => 'binary', 'text/html' => 'html', 'xml' => 'xml', 'GraphQL' => 'GraphQL', 'raw' => 'raw', ); if ( 'none' === $data_type ) { $data_type = 'raw'; } if ( in_array( $data_type, $supported_data_types, true ) ) { $type = array_search( $data_type, $supported_data_types, true ); $headers['Content-Type'] = $type; return $headers; } $headers['Content-Type'] = 'application/x-www-form-urlencoded'; return $headers; }
Expand full source code Collapse full source code View on Github