Esempio n. 1
0
        internal static object GetHttpOutputBindingResponse(string bindingName, IDictionary <string, object> outputsFromWorker)
        {
            HttpOutputBindingResponse httpOut = new HttpOutputBindingResponse();

            if (outputsFromWorker.TryGetValue(bindingName, out object outputBindingValue))
            {
                try
                {
                    httpOut = JsonConvert.DeserializeObject <HttpOutputBindingResponse>(outputBindingValue.ToString());
                }
                catch
                {
                    //ignore
                }
            }
            return(JsonConvert.SerializeObject(httpOut));
        }
Esempio n. 2
0
        internal static object GetHttpOutputBindingResponse(string bindingName, IDictionary <string, object> outputsFromWorker)
        {
            dynamic httpOutput = new ExpandoObject();

            if (outputsFromWorker.TryGetValue(bindingName, out object outputBindingValue))
            {
                try
                {
                    HttpOutputBindingResponse httpOutputBindingResponse = JsonConvert.DeserializeObject <HttpOutputBindingResponse>(outputBindingValue.ToString());

                    httpOutput.StatusCode = httpOutputBindingResponse.StatusCode;
                    httpOutput.Status     = httpOutputBindingResponse.Status;
                    httpOutput.Body       = httpOutputBindingResponse.Body;
                    httpOutput.Headers    = httpOutputBindingResponse.Headers;
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("Failed while trying to Deserialize to httpOutputBindingResponse. Output is not in expected format", ex.InnerException);
                }
            }
            return(httpOutput);
        }