private Item ConvertRequest(PST.Request postmanRequest) { if (postmanRequest == null) { return(null); } var baseUrl = Uri.IsWellFormedUriString(postmanRequest.Url?.Raw, UriKind.Absolute) ? new Uri(postmanRequest.Url.Raw).GetLeftPart(UriPartial.Path) : postmanRequest.Url?.Raw; var result = new Item { Type = ItemType.Request, Url = new Url { Base = baseUrl, Queries = new List <Parameter>() }, Body = ConvertBody(postmanRequest.Body), Method = postmanRequest.Method, Auth = ConvertAuth(postmanRequest.Auth) }; // Headers if (postmanRequest.Header != null && postmanRequest.Header.Length > 0) { foreach (var header in postmanRequest.Header) { result.Headers.Add(new Parameter { Enabled = !header.Disabled, Key = header.Key, Value = header.Value, Type = ParamType.Header }); } } // Queries if (postmanRequest.Url?.Query != null) { foreach (var query in postmanRequest.Url.Query) { result.Url.Queries.Add(new Parameter { Enabled = !query.Disabled, Key = query.Key, Value = query.Value, Type = ParamType.Parameter }); } } return(result); }
private Item ConvertRequest(PST.Request postmanRequest) { if (postmanRequest == null) { return(null); } var result = new Item { Type = ItemType.Request, Url = new Url { Base = postmanRequest.Url?.Raw }, Body = ConvertBody(postmanRequest.Body), Method = postmanRequest.Method, Auth = ConvertAuth(postmanRequest.Auth) }; // Headers if (postmanRequest.Header != null && postmanRequest.Header.Length > 0) { foreach (var header in postmanRequest.Header) { result.Headers.Add(new Parameter { Enabled = !header.Disabled, Key = header.Key, Value = header.Value, Type = ParamType.Header }); } } // Queries if (postmanRequest.Url?.Query != null) { foreach (var query in postmanRequest.Url.Query) { result.Url.Queries.Add(new Parameter { Enabled = !query.Disabled, Key = query.Key, Value = query.Value, Type = ParamType.Header }); } } return(result); }