Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling ZnHeaders>>#contentType raises an DNU exception if multiple Content-Type headers are present #57

Open
udoschneider opened this issue Aug 15, 2020 · 0 comments

Comments

@udoschneider
Copy link

In ZnHeaders>>#contentType #trimBoth is sent to header's Content-Type value:

headerValue := (self headers at: 'Content-Type') trimBoth.

If only a single Content-Type header was part of the response the result of (self headers at: 'Content-Type') is a String and everything works. However if the response specified multiple Content-Type headers the result is an Array and calling #trimBoth raises an exception.

A simple testcase to raise the error:

ZnHeadersTest>>#testMultiValuedContentType
	| headers |
	headers := ZnHeaders new.
	headers at: 'Content-Type' put: 'application/javascript'.
	headers at: 'Content-Type' add: 'application/x-javascript'.
	self
		assert: (headers at: 'Content-Type')
		equals: #('application/javascript' 'application/x-javascript').
	self
		shouldnt: [ headers contentType ]
		raise: Error
		description: '''Content-Type'' could have multiple values.'
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

No branches or pull requests

1 participant