Esempio n. 1
0
        public object Any(Postman request)
        {
            var feature = HostContext.GetPlugin <PostmanFeature>();

            if (request.ExportSession)
            {
                if (feature.EnableSessionExport != true)
                {
                    throw new ArgumentException("PostmanFeature.EnableSessionExport is not enabled");
                }

                var url = Request.ResolveBaseUrl()
                          .CombineWith(Request.PathInfo)
                          .AddQueryParam("ssopt", Request.GetItemOrCookie(SessionFeature.SessionOptionsKey))
                          .AddQueryParam("sspid", Request.GetPermanentSessionId())
                          .AddQueryParam("ssid", Request.GetTemporarySessionId());

                return(HttpResult.Redirect(url));
            }

            var id  = SessionExtensions.CreateRandomSessionId();
            var ret = new PostmanCollection
            {
                id        = id,
                name      = HostContext.AppHost.ServiceName,
                timestamp = DateTime.UtcNow.ToUnixTimeMs(),
                requests  = GetRequests(request, id, HostContext.Metadata.OperationsMap.Values),
            };

            return(ret);
        }
Esempio n. 2
0
        public object Any(Postman request)
        {
            var feature = HostContext.GetPlugin<PostmanFeature>();

            if (request.ExportSession)
            {
                if (feature.EnableSessionExport != true)
                    throw new ArgumentException("PostmanFeature.EnableSessionExport is not enabled");

                var url = Request.ResolveBaseUrl()
                    .CombineWith(Request.PathInfo)
                    .AddQueryParam("ssopt", Request.GetItemOrCookie(SessionFeature.SessionOptionsKey))
                    .AddQueryParam("sspid", Request.GetPermanentSessionId())
                    .AddQueryParam("ssid", Request.GetTemporarySessionId());

                return HttpResult.Redirect(url);
            }

            var id = SessionExtensions.CreateRandomSessionId();
            var ret = new PostmanCollection
            {
                id = id,
                name = HostContext.AppHost.ServiceName,
                timestamp = DateTime.UtcNow.ToUnixTimeMs(),
                requests = GetRequests(request, id, HostContext.Metadata.OperationsMap.Values),
            };

            return ret;
        }