har2postman
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -50,2 +50,14 @@ const HarToPostman = () => { }; | ||
break; | ||
case 201: | ||
status = 'created'; | ||
break; | ||
case 202: | ||
status = 'accepted'; | ||
break; | ||
case 204: | ||
status = 'no-content'; | ||
break; | ||
case 403: | ||
status = 'forbidden'; | ||
break; | ||
} | ||
@@ -115,3 +127,6 @@ let itemName = method + ' ' + path; | ||
relevantHarHeaders.map((relevantHeader) => { | ||
itemRequestHeaders.push(harRequestHeaders.find((header) => header.name === relevantHeader)); | ||
const newItemRequestHeader = harRequestHeaders.find((header) => header.name === relevantHeader); | ||
if (newItemRequestHeader != undefined) { | ||
itemRequestHeaders.push(newItemRequestHeader); | ||
} | ||
}); | ||
@@ -168,9 +183,13 @@ itemRequestHeaders.forEach((header) => { | ||
const id = getIdFromUrl(harRequestUrl); | ||
return response.content && response.content.text && parseInt(JSON.parse(response.content.text).id) === id; | ||
return responseIsJson(response) && parseInt(JSON.parse(response.content.text).id) === id; | ||
}; | ||
const responseIsArray = (response) => { | ||
return response.content && response.content.text && Array.isArray(JSON.parse(response.content.text)); | ||
return responseIsJson(response) && Array.isArray(JSON.parse(response.content.text)); | ||
}; | ||
const responseIsJson = (response) => { | ||
return response.content && response.content.text && response.content.mimeType === 'application/json'; | ||
}; | ||
const getIdFromUrl = (harRequestUrl) => { | ||
@@ -177,0 +196,0 @@ const harPathnameArray = harRequestUrl.pathname.split('/'); |
{ | ||
"name": "har2postman", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Har to postman converter", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -70,3 +70,4 @@ # Har2Postman | ||
### v0.6.0 - Any status code must be supported | ||
* Status code such as 200, 204, 400, 401, 403 or 404 must have specific assertions. | ||
* Status code such as 200, 204, 400, 401, 403 or 404 must have specific assertions. | ||
* Non-json responses should even not tried to be analysed | ||
@@ -76,3 +77,2 @@ | ||
### Future features still to be planned | ||
* Status codes other than 200 should be supported, and tests for them should be consistent (not checking id is correct for a 400 code) | ||
* Requests could include some way of authorization | ||
@@ -79,0 +79,0 @@ * Requests might include more useful headers |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
186245
27
5329
7