Skip to content

Commit 5ad5333

Browse files
authored
Fix potential fatal errors
oembed filters this and returns WP_Error sometimes, so this was triggering fatal errors, so this does a check instead of a hard require
1 parent 07583cb commit 5ad5333

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ManageTokens.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,12 @@ public static function add_tokens_to_graphql_response_headers( $headers ) {
318318
* @return \WP_HTTP_Response
319319
* @throws \Exception
320320
*/
321-
public static function add_auth_headers_to_rest_response( \WP_HTTP_Response $response, $handler, $request ) {
322-
321+
public static function add_auth_headers_to_rest_response( $response, $handler, $request ) {
322+
323+
if( ! $response instanceof \WP_HTTP_Response ) {
324+
return $response;
325+
}
326+
323327
/**
324328
* If the request _is_ SSL, or GRAPHQL_DEBUG is defined, return the tokens
325329
* otherwise do not return them.

0 commit comments

Comments
 (0)