fix: return native web api responses

This commit is contained in:
Meik
2026-07-01 09:44:48 +02:00
parent 80265ec1da
commit 6cb9e3b5fd
3 changed files with 26 additions and 8 deletions

View File

@@ -37,6 +37,20 @@
" pm.response.to.be.json;",
" }",
" });",
"",
" const contentType = pm.response.headers.get(\"Content-Type\") || \"\";",
" if (contentType.toLowerCase().includes(\"json\")) {",
" const json = pm.response.json();",
" const isSerializedHttpResponse = json && !Array.isArray(json) &&",
" Object.prototype.hasOwnProperty.call(json, \"Version\") &&",
" Object.prototype.hasOwnProperty.call(json, \"Content\") &&",
" Object.prototype.hasOwnProperty.call(json, \"StatusCode\") &&",
" Object.prototype.hasOwnProperty.call(json, \"IsSuccessStatusCode\");",
"",
" pm.test(\"Response is not a serialized HttpResponseMessage\", function () {",
" pm.expect(isSerializedHttpResponse).to.equal(false);",
" });",
" }",
"}"
]
}