/// <summary>
        /// Creates the request from a given endpoint and request body.
        /// </summary>
        /// <returns>The HTTP request.</returns>
        /// <param name="endpoint">Endpoint.</param>
        /// <param name="payload">The request payload.</param>
        public HttpRequestMessage CreateRequest(IEndpoint endpoint, object payload)
        {
            var httpContent = GetRequestContent(payload);
            var request     = proxiedFactory.CreateRequest(endpoint, httpContent);

            AddAcceptsJsonHeader(request);
            return(request);
        }
Example #2
0
        /// <summary>
        /// Performs this operation, as the given actor.
        /// </summary>
        /// <param name="actor">The actor performing this task.</param>
        protected override void PerformAs(IPerformer actor)
        {
            var ability  = actor.GetAbility <ConsumeWebServices>();
            var request  = requestFactory.CreateRequest(endpoint, payload);
            var response = ability.SynchronousHttpClient.Send(request, timeout ?? endpoint.Timeout);

            responseVerifier.AssertThatResponseIsSuccessful(response);
        }