-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
This code does not work when run on the CLI, which poses a problem when trying to write tests which send headers.
util-universalframework/src/Codeception/Lib/Connector/Universal.php
Lines 54 to 69 in f9da1f8
| $headers = []; | |
| $php_headers = headers_list(); | |
| foreach ($php_headers as $value) { | |
| // Get the header name | |
| $parts = explode(':', $value); | |
| if (count($parts) > 1) { | |
| $name = trim(array_shift($parts)); | |
| // Build the header hash map | |
| $headers[$name] = trim(implode(':', $parts)); | |
| } | |
| } | |
| $headers['Content-type'] = isset($headers['Content-type']) | |
| ? $headers['Content-type'] | |
| : "text/html; charset=UTF-8"; | |
| $response = new Response($content, 200, $headers); |
From what I can tell the header() function on the CLI does absolutely nothing so the headers are not stored for later retrieval.
There are a few other problems with this code like it always returns a 200 response code, headers are case insensitive which could break the isset(), the same header can be sent multiple times so only the last one will be kept by this code.
Metadata
Metadata
Assignees
Labels
No labels