diff --git a/src/Service/DKApiRequest.php b/src/Service/DKApiRequest.php index cc7b363..91d5d90 100644 --- a/src/Service/DKApiRequest.php +++ b/src/Service/DKApiRequest.php @@ -15,7 +15,9 @@ * Handles the low-level HTTP requests to the DK JSON API. */ class DKApiRequest { - const DK_API_URL = 'https://api.dkplus.is/api/v1'; + const DK_API_URL = 'https://api.dkplus.is/api/v1'; + const GET_TIMEOUT = 10.0; + const POST_TIMEOUT = 15.0; /** * The DK API key @@ -83,6 +85,7 @@ public function get_result( string $path ): WP_Error|stdClass { array( 'httpversion' => '1.1', 'headers' => $this->get_headers, + 'timeout' => self::GET_TIMEOUT, ), ); @@ -117,6 +120,7 @@ public function get_table_result( array( 'httpversion' => '1.1', 'headers' => $this->get_headers, + 'timeout' => self::GET_TIMEOUT, ), ); @@ -155,6 +159,7 @@ public function request_result( 'httpversion' => '1.1', 'headers' => $this->post_headers, 'body' => $body, + 'timeout' => self::POST_TIMEOUT, ), );