Exemplo n.º 1
0
        /// <summary>
        /// Determines the whether response body should be written based on the request verb and the uri.
        /// NOTE: Does not consider the client's preference when determining this.
        /// </summary>
        /// <param name="requestVerb">The request verb.</param>
        internal void DetermineWhetherResponseBodyOrETagShouldBeWritten(HttpVerbs requestVerb)
        {
            if (this.responseBodyOrETagShouldBeWritten.HasValue)
            {
                return;
            }

            this.responseBodyOrETagShouldBeWritten = true;

            if (this.TargetSource != RequestTargetSource.ServiceOperation)
            {
                if (requestVerb.IsInsert() || requestVerb.IsUpdate())
                {
                    this.responseBodyOrETagShouldBeWritten = !this.LinkUri;
                }
                else if (requestVerb.IsDelete())
                {
                    this.responseBodyOrETagShouldBeWritten = false;
                }
            }
            else if (this.TargetKind == RequestTargetKind.VoidOperation)
            {
                this.responseBodyOrETagShouldBeWritten = false;
            }
        }