Skip to content

[MessageTrait] Fix withAddedHeader() with array $value#4

Merged
kirill-konshin merged 1 commit intoringcentral:masterfrom
siwinski:pr-fix-messagetrait-withaddedheader-array-value
Jan 15, 2018
Merged

[MessageTrait] Fix withAddedHeader() with array $value#4
kirill-konshin merged 1 commit intoringcentral:masterfrom
siwinski:pr-fix-messagetrait-withaddedheader-array-value

Conversation

@siwinski
Copy link
Copy Markdown
Contributor

@siwinski siwinski commented Jan 13, 2018

This pull request fixes an issue when withAddedHeader()'s input param $value is an array. After the changes in this pull request, output will match Guzzle's and Diactoros' output.

Issue example:

<?php

$guzzleResponse = (new GuzzleHttp\Psr7\Response('200', array('test' => 'one')))
    ->withAddedheader('test', array('two'));
echo "Guzzle header: ";
print_r($guzzleResponse->getHeader('test'));

$diactorosResponse = (new Zend\Diactoros\Response('php://memory', 200, array('test' => 'one')))
    ->withAddedheader('test', array('two'));
echo "Diactoros header: ";
print_r($guzzleResponse->getHeader('test'));

$ringCentralResponse = (new RingCentral\Psr7\Response('200', array('test' => 'one')))
    ->withAddedheader('test', array('two'));
echo "RingCentral header: ";
print_r($ringCentralResponse->getHeader('test'));

Issue example output:

Guzzle header: Array
(
    [0] => one
    [1] => two
)
Diactoros header: Array
(
    [0] => one
    [1] => two
)
RingCentral header: Array
(
    [0] => one
    [1] => Array
        (
            [0] => two
        )

)

@siwinski
Copy link
Copy Markdown
Contributor Author

Failed Travis build should be fixed by #5

Copy link
Copy Markdown
Contributor

@clue clue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thank you for looking into this! 👍

@kirill-konshin
Copy link
Copy Markdown
Contributor

Pls rebase and re run the tests

@siwinski siwinski force-pushed the pr-fix-messagetrait-withaddedheader-array-value branch from 0f12101 to dcf104b Compare January 15, 2018 15:57
@siwinski
Copy link
Copy Markdown
Contributor Author

Pls rebase and re run the tests

@kirill-konshin done

@kirill-konshin kirill-konshin merged commit dcd84bb into ringcentral:master Jan 15, 2018
@kirill-konshin
Copy link
Copy Markdown
Contributor

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants