Beispiel #1
0
        public HttpResponseMessage ConfigureMsg(MediaTypeFormatter formatter, Tuple <int, int, int> cacheSettings)
        {
            HttpResponseMessage msg = Representation.GetAsMessage(formatter, cacheSettings);

            foreach (WarningHeaderValue w in WarningHeaders)
            {
                msg.Headers.Warning.Add(w);
            }

            foreach (string a in AllowHeaders)
            {
                msg.Content.Headers.Allow.Add(a);
            }

            if (Location != null)
            {
                msg.Headers.Location = Location;
            }

            if (Etag != null)
            {
                msg.Headers.ETag = Etag;
            }

            ValidateOutgoingMediaType(Representation is AttachmentRepresentation);
            msg.StatusCode = HttpStatusCode;

            return(msg);
        }