diff --git a/ExportSessionsToPostmanCollection/ExportSessionsToPostmanCollection.csproj b/ExportSessionsToPostmanCollection/ExportSessionsToPostmanCollection.csproj
index 236832a..e395a86 100644
--- a/ExportSessionsToPostmanCollection/ExportSessionsToPostmanCollection.csproj
+++ b/ExportSessionsToPostmanCollection/ExportSessionsToPostmanCollection.csproj
@@ -32,7 +32,7 @@
- ..\..\..\Users\bdrupieski\AppData\Local\Programs\Fiddler\Fiddler.exe
+ ..\packages\Fiddler.exe
..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll
@@ -58,7 +58,7 @@
- copy "$(TargetPath)" "%25userprofile%25\My Documents\Fiddler2\ImportExport\$(TargetFilename)"
-copy "Newtonsoft.Json.dll" "%25userprofile%25\My Documents\Fiddler2\ImportExport\Newtonsoft.Json.dll"
+ copy "$(TargetPath)" "%25userprofile%25\AppData\Local\Programs\Fiddler\ImportExport\$(TargetFilename)"
+copy "Newtonsoft.Json.dll" "%25userprofile%25\AppData\Local\Programs\Fiddler\ImportExport\Newtonsoft.Json.dll"
\ No newline at end of file
diff --git a/ExportSessionsToPostmanCollection/PostmanCollection.cs b/ExportSessionsToPostmanCollection/PostmanCollection.cs
index 60bef53..6fb4bc2 100644
--- a/ExportSessionsToPostmanCollection/PostmanCollection.cs
+++ b/ExportSessionsToPostmanCollection/PostmanCollection.cs
@@ -20,7 +20,7 @@ public class PostmanItem
{
public string Name { get; set; }
public PostmanRequest Request { get; set; }
- public PostmanResponse Response { get; set; }
+ public List Response { get; set; }
}
public class PostmanRequest
@@ -45,8 +45,17 @@ public class PostmanBody
{
public string Mode { get; set; }
public string Raw { get; set; }
+ public PostmanRequestOptions Options { get; set; }
}
+ public class PostmanRequestOptions
+ {
+ public PostmanRequestOptionsRow Row { get; set; }
+ }
+ public class PostmanRequestOptionsRow
+ {
+ public string Language { get; set; }
+ }
public class PostmanRequestAuth
{
public string Type { get; set; }
@@ -62,6 +71,7 @@ public class PostmanResponse
public List Header { get; set; }
public List Cookie { get; set; }
public string Body { get; set; }
+ public string _postman_previewlanguage { get; set; }
}
public class PostmanListItem
diff --git a/ExportSessionsToPostmanCollection/PostmanSessionExporter.cs b/ExportSessionsToPostmanCollection/PostmanSessionExporter.cs
index f45f701..cbcd73f 100644
--- a/ExportSessionsToPostmanCollection/PostmanSessionExporter.cs
+++ b/ExportSessionsToPostmanCollection/PostmanSessionExporter.cs
@@ -54,7 +54,7 @@ bool ReportProgress(float percentage, string message)
if (oSessions.Length > 100)
{
- var confirmResult = MessageBox.Show($"You're about to export {oSessions.Length} sessions. That's a lot. Are you sure you want to do that?",
+ var confirmResult = MessageBox.Show($"You're about to export {oSessions.Length} sessions. That's a lot. Are you sure you want to do that?",
"Just Checking", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (confirmResult != DialogResult.Yes)
@@ -86,20 +86,33 @@ bool ReportProgress(float percentage, string message)
{
Mode = "raw",
Raw = session.GetRequestBodyAsString(),
+ Options = new PostmanRequestOptions
+ {
+ Row = new PostmanRequestOptionsRow
+ {
+ Language = "json",
+ }
+ }
},
},
- Response = new PostmanResponse
- {
- Code = session.responseCode,
- Name = session.PathAndQuery,
- Body = session.GetResponseBodyAsString(),
- Status = session.ResponseHeaders.StatusDescription,
- Header = new List(session.ResponseHeaders.Count() + 1),
+ Response = new List(){
+ new PostmanResponse
+ {
+ Code = session.responseCode,
+ Name = session.PathAndQuery,
+ Body = session.GetResponseBodyAsString(),
+ Status = session.ResponseHeaders.StatusDescription,
+ Header = new List(session.ResponseHeaders.Count() + 1),
+ _postman_previewlanguage = "json",
+ }
},
};
+ postmanItem.Response[0].OriginalRequest = postmanItem.Request;
+
foreach (var requestHeader in session.RequestHeaders)
{
+ if (requestHeader.Name == "Host") continue;
postmanItem.Request.Header.Add(new PostmanListItem
{
Type = "text",
@@ -110,7 +123,7 @@ bool ReportProgress(float percentage, string message)
foreach (var responseHeader in session.ResponseHeaders)
{
- postmanItem.Response.Header.Add(new PostmanListItem
+ postmanItem.Response[0].Header.Add(new PostmanListItem
{
Key = responseHeader.Name,
Value = responseHeader.Value
diff --git a/README.md b/README.md
index 1927eec..87fe032 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,7 @@
+# 20220421
+
+修复 reponse,并将类型改为 json。
+
# FiddlerExportToPostman
This is a Fiddler extension for exporting sessions into a format that can be imported by Postman.