Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Figure out how to make immutable header value objects #177

Closed
Tratcher opened this issue Jan 21, 2015 · 1 comment
Closed

Figure out how to make immutable header value objects #177

Tratcher opened this issue Jan 21, 2015 · 1 comment

Comments

@Tratcher
Copy link
Member

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:

  • 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.
@Tratcher Tratcher changed the title Figure out how to handle immutable header values Figure out how to make immutable header value objects Jan 21, 2015
@Tratcher Tratcher added this to the 1.0.0-rc1 milestone Jan 21, 2015
@muratg muratg modified the milestones: 1.0.0-beta5, 1.0.0-beta4 Mar 25, 2015
@Tratcher Tratcher modified the milestones: 1.0.0-beta5, 1.0.0-beta6 Jun 11, 2015
@Tratcher Tratcher self-assigned this Jun 12, 2015
Tratcher added a commit that referenced this issue Jun 24, 2015
Tratcher added a commit that referenced this issue Jun 25, 2015
@Tratcher
Copy link
Member Author

@rynowak

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants