From 04b9c4febf67ac2f129884906371d9a9828483e3 Mon Sep 17 00:00:00 2001 From: stas Date: Thu, 1 Apr 2021 13:21:48 -0700 Subject: [PATCH] Imporove body parsing of RESTler bugs when converting to Postman collection --- src/Agent/RESTler2Postman/Program.fs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Agent/RESTler2Postman/Program.fs b/src/Agent/RESTler2Postman/Program.fs index 985ce627..24dfc135 100644 --- a/src/Agent/RESTler2Postman/Program.fs +++ b/src/Agent/RESTler2Postman/Program.fs @@ -83,7 +83,7 @@ let parseRequest (x: string) = | _ -> None match rs with - | "" :: body :: "" :: [] -> headers, Some body + | "" :: body :: "" :: [] | "" :: body :: [] -> headers, Some body | r :: "" :: [] -> match parseHeader r with | Some(k, v) -> @@ -99,8 +99,11 @@ let parseRequest (x: string) = let body = match body with | Some s -> - let b = Json.Compact.deserialize(s.Replace("\\n", "")) - Some(b.ToString()) + if String.IsNullOrWhiteSpace s then + None + else + let b = Json.Compact.deserialize(s.Replace("\\n", "")) + Some(b.ToString()) | None -> None {|