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.
The code above will throw an exception on the second addition.
This was permissible in Web API 2.
//Web API 2 Example// GET api/valuespublicIHttpActionResultGet(){varresponse=Request.CreateResponse(HttpStatusCode.OK);response.Headers.Add("Hello",newstring[]{"One"});response.Headers.Add("Hello",newstring[]{"Two","Three"});returnResponseMessage(response);}
In this scenario, Web API 2 adds the header values to the underlying values collection. I think this is the right behavior because that was the developer's intention even though they broke the contract.