$headers = getHeaders(); foreach ($headers as $name => $value) { echo "$name: $value\n"; }
if (getHeaders()['Content-Type'] === 'application/json') { // Do something if the request body is JSON }In this example, we check the value of the `Content-Type` header to determine if the request body is JSON. If it is, we can proceed with processing the request. Package library: This function is built-in and does not require any external package library to be used.