-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
Hi,
I'm trying to create a mock with headers validation. I'm using callback for that.
I'm getting this error:
Fatal error: Function name must be a string in /vendor/jeremeamia/SuperClosure/src/SerializableClosure.php(210) : eval()'d code on line 2
My code looks like this:
$method = 'POST';
$path = '/path';
$requestHeaders = [
'Content-Type' => 'application/json'
];
$this->http->mock
->when()
->methodIs($method)
->pathIs($path)
->callback(static function(Request $request) use($requestHeaders) {
foreach ($requestHeaders as $header => $value) {
if (!$request->hasHeader($header) || $request->getHeader($header) != $value) {
return false;
}
}
return true;
})
->then()
->statusCode(200)
->body('ok')
->end();
Because of that bug, I cannot validate expected request headers. Could you please provide some alternative method to validate request headers until this issue is fixed?
Thanks
Metadata
Metadata
Assignees
Labels
No labels