[Pharo-dev] XMLHTTP[Request|Response]>>#testAddHeader #testHeaderValuesAdd - Zinc HTTPComponents

Sven Van Caekenberghe sven at stfx.eu
Thu Feb 14 08:09:24 EST 2019


I noticed that some tests from XML Support started failing with the latest version of Zinc. The 4 tests are XMLHTTP[Request|Response]>>#testAddHeader #testHeaderValuesAdd

And yes, something changed recently (a couple of months ago) in Zinc: ZnMultiValueDictionary>>#at:add: became idempotent (by design).

ZnMultiValueDictionary is like a dictionary but allows for multiple entries per key.

In practice this is used for the headers of an HTTP request or response and for the query values of a URL. Using the second application as an example, this means that


contains 2 simple key/value pairs (a=1 and b=2), while


contains 1 normal key (b=2) and 1 extended key with 2 values (a=1 and a=-1).

With the recent change,


is the same (idempotent) as the previous one, since b=2 occurs twice with exactly the same key and value.

XMLHTTP[Request|Response]>>#testAddHeader #testHeaderValuesAdd assume that adding the same key and value more than once should be relevant (not be idempotent).

In HTTP headers, this means that Connection:close can occur multiple times but that that would be totally equivalent to it occurring only once.

I think that XMLHTTP is wrong and Zinc is right.

Opinions ?


More information about the Pharo-dev mailing list