Skip to content

response headers handling - same key, different values #57

@dneves

Description

@dneves

If the server sends 2 or more headers with the same key, the last_headers array contains only the last header sent from the server in the corresponding key.

for example, if the server sends 2 http Link headers in the response,
Link: <SOME_URL>; rel="REL_NAME"
Link: <SOME_SECOND_URL>; rel="SECOND_REL_NAME"
, only the second is saved in the Pest.last_headers array :

private function handle_header($ch, $str) {
        if (preg_match('/([^:]+):\s(.+)/m', $str, $match)) {
            $this->last_headers[strtolower($match[1])] = trim($match[2]);
        }
        return strlen($str);
    }

this handler replaces headers with the same name.

if i make the same request directly in chrome, in the network tab i can see it parses all headers...

do you have any plans on fixing this ?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions