This project is read-only.


Add Set* extension methods for all HttpRequestMessage properties


For unit testing you often need to setup a full HttpRequestMessage so that conneg can be run in the API controller action. We have Get* extension methods for the properties hanging off of HttpRequestMessage.Properties but we don't hvae Set* methods. We should add the Set* methods.
Closed Jun 17, 2013 at 12:55 AM by eilonlipton
Closing this because we have made unit testing much easier in Web API, as noted in this spec page:

The HttpPropertyKeys are public so people wanting to write tests that depend on the property bag can set them manually.

If there are specific unit testing issues still remaining we should have specific bugs on those.


HenrikN wrote Sep 4, 2012 at 10:16 PM

We should consider making the HttpPropertyKeys internal so that people go through the Getter/Setter instead. That would be much more robust moving forward.

marcind wrote Sep 5, 2012 at 7:25 AM

Making it obsolete might be too much of a breaking change. But we could certainly make mark those properties as obsolete.

marcind wrote Sep 5, 2012 at 7:26 AM

Sorry, meant to say that making it internal would be a breaking change. Obsolete should be fine though.

HongmeiG wrote Mar 19, 2013 at 1:55 AM

I think all the helpers have been added. Please confirm.

HongmeiG wrote Mar 19, 2013 at 1:56 AM

BTW, let us not make those keys internal or obsolete. There is no good reason to break existing app here.