On Monday, November 12, 2018 7:37:03 AM CST Stefano Torresi wrote:
> > Like, why doesn't it have a withHeaders() method that lets you
> > apply/replace all the headers?
> 
> I guess because what that would do in every implementation is calling
> `withHeader` in a loop. :-P
> 
> Is this really that big of a problem? OTOH the message interface is already
> quite crowded.
> 
> Also, a very lengthy discussion could be made on how the `$headers` input
> array should or shouldn't be structured.

Matthew and I talked about that during the PSR-7 development.  It was one of 
the confusion points I had in my own implementation attempts.  Specifically, 
is withHeaders() "replace all headers and have just these" or is it "multi-add 
these headers, as if you were looping"?  Or "multi-add but replace existing 
headers if the name already exists, which is different behavior than a loop on 
addHeader()"?  

It was just too confusing, so since a loop on withHeader() is so cheap the 
decision was to go for the smaller, more self-documenting surface area.

--Larry Garfield

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/1711626.aciqfvl2hO%40vulcan.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to