public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            var forwardingRequest = new ForwardingRequest(req.RequestUri);

            using (var client = new HttpClient())
            {
                var resp = await client.PostAsync(forwardingRequest.ForwardingUrl,
                                                  new StringContent(forwardingRequest.JsonContent));

                return(req.CreateResponse(HttpStatusCode.OK, await resp.Content.ReadAsStringAsync()));
            }
        }
Example #2
0
        private void ValidForwardingUrl(params Parameter[] queryParameters)
        {
            var forwardingRequest = new ForwardingRequest(CreateRequestUrl(queryParameters));

            Assert.AreEqual(
                forwardingRequest.ForwardingUrl,
                GetResultUrl(queryParameters.Except(ForwardingArray).ToArray()));
            var jsonToken = JToken.Parse(forwardingRequest.JsonContent);

            foreach (var queryParameter in queryParameters)
            {
                if (queryParameter == ForwardingUrlParam)
                {
                    continue;
                }
                var value     = ((JValue)jsonToken[queryParameter.Key]).Value;
                var compValue = queryParameter.RawValue;
                if (compValue is int)
                {
                    compValue = Convert.ToInt64(compValue);
                }
                Assert.AreEqual(value, compValue);
            }
        }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ForwardingRequest obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }