Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.

Commit ecc6a6d

Browse files
stishkinstas
andauthored
Imporove body parsing of RESTler bugs when converting to Postman collection (#183)
Co-authored-by: stas <statis@microsoft.com>
1 parent 740933f commit ecc6a6d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Agent/RESTler2Postman/Program.fs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ let parseRequest (x: string) =
8383
| _ -> None
8484

8585
match rs with
86-
| "" :: body :: "" :: [] -> headers, Some body
86+
| "" :: body :: "" :: [] | "" :: body :: [] -> headers, Some body
8787
| r :: "" :: [] ->
8888
match parseHeader r with
8989
| Some(k, v) ->
@@ -99,8 +99,11 @@ let parseRequest (x: string) =
9999
let body =
100100
match body with
101101
| Some s ->
102-
let b = Json.Compact.deserialize(s.Replace("\\n", ""))
103-
Some(b.ToString())
102+
if String.IsNullOrWhiteSpace s then
103+
None
104+
else
105+
let b = Json.Compact.deserialize(s.Replace("\\n", ""))
106+
Some(b.ToString())
104107
| None -> None
105108

106109
{|

0 commit comments

Comments
 (0)