easypay-v21/includes/ApiValidator.php CHANGED
@@ -35,14 +35,16 @@ class ApiValidator
35
  ];
36
  }
37
 
38
- // Check Content-Type header
39
- $contentType = $_SERVER['CONTENT_TYPE'] ?? '';
40
- if (stripos($contentType, 'application/json') === false) {
41
- return [
42
- 'valid' => false,
43
- 'error' => 'Invalid Content-Type. Expected application/json',
44
- 'http_code' => 400
45
- ];
 
 
46
  }
47
 
48
  // Validate API key if configured
 
35
  ];
36
  }
37
 
38
+ // Check Content-Type header (only for methods with body)
39
+ if (in_array($method, ['POST', 'PUT', 'PATCH'])) {
40
+ $contentType = $_SERVER['CONTENT_TYPE'] ?? '';
41
+ if (stripos($contentType, 'application/json') === false) {
42
+ return [
43
+ 'valid' => false,
44
+ 'error' => 'Invalid Content-Type. Expected application/json',
45
+ 'http_code' => 400
46
+ ];
47
+ }
48
  }
49
 
50
  // Validate API key if configured