You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 20, 2018. It is now read-only.
Scenario:
MVC uses some lists of MediaTypeHeaderValues to determine what formats are supported. They select one from the list and use it to configure the response. Sometimes this involves modifying the value (e.g. adding charset), however this affects the value in the list and may impact matching and output for subsequent requests. The correct code would make a copy of the header value first.
Figure out how to make immutable header value object to prevent erroneous modifications.
Some ideas:
Add a method (MakeReadOnly()) or property (IsReadOnly) to lock a header value object into read-only mode so it throws if anyone tries to make inappropriate modifications.
Have an abstract base class with mutable and immutable implementations.
The text was updated successfully, but these errors were encountered:
Tratcher
changed the title
Figure out how to handle immutable header values
Figure out how to make immutable header value objects
Jan 21, 2015
Related: #176
Scenario:
MVC uses some lists of MediaTypeHeaderValues to determine what formats are supported. They select one from the list and use it to configure the response. Sometimes this involves modifying the value (e.g. adding charset), however this affects the value in the list and may impact matching and output for subsequent requests. The correct code would make a copy of the header value first.
Figure out how to make immutable header value object to prevent erroneous modifications.
Some ideas:
MakeReadOnly()
) or property (IsReadOnly
) to lock a header value object into read-only mode so it throws if anyone tries to make inappropriate modifications.The text was updated successfully, but these errors were encountered: