You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.
I have found the problem, in the collection that you paste the response headers of the first request example called "Récupération token" has anull value, when I have import to postman and import as collection v2.1 postman put this value to an empty array [], has an easy solution but is very strange that Postman has this behaviuour what version of postman are you using?
Hi,
i try to transform Postman collection to OpenAPI file.
I have a problem with response.
TypeError: Cannot read property 'reduce' of null
my postman Json
{ "info": { "_postman_id": "4b33ade6-60b3-48e7-a441-c723b9c8b8bb", "name": "Information sociétaire", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Authentification", "item": [ { "name": "Récupération token", "event": [ { "listen": "test", "script": { "exec": [ "const jsonData = pm.response.json();\r", "\r", "pm.test(\"Réponse OK\", function () \r", "{\r", " postman.setNextRequest(null);\r", " pm.expect(jsonData.codeErreur).to.eq(0);\r", " pm.response.to.have.status(200);\r", " postman.setNextRequest(\"Associer distributeur au token\");\r", "});\r", "\r", "pm.collectionVariables.set(\"token\", jsonData.contenu.token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\r\n \"contenu\":\r\n {\r\n \"compte\": \"{{compte}}\",\r\n \"motDePasse\": \"{{motDePasse}}\",\r\n \"identifiant\": \"{{identifiant}}\"\r\n }\r\n}" }, "url": { "raw": "{{url}}/{{webApp}}/token", "host": [ "{{url}}" ], "path": [ "{{webApp}}", "token" ] }, "description": "Méthode d'authentification \nRetourne un token en cas de succès" }, "response": [ { "name": "Récupération token", "originalRequest": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\r\n \"contenu\": {\r\n \"compte\": \"\",\r\n \"motDePasse\": \"\",\r\n \"identifiant\": \"\"\r\n }\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{url}}/{{webApp}}/token", "host": [ "{{url}}" ], "path": [ "{{webApp}}", "token" ] } }, "status": "OK", "code": 200, "_postman_previewlanguage": "json", "header": null, "cookie": [], "body": "{\n \"erreur\": null,\n \"codeErreur\": 0,\n \"contenu\": {\n \"token\": \"ct54q7uoidffg2z661afigu98ix476s8\"\n }\n}" } ] }, { "name": "Associer distributeur au token", "event": [ { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } }, { "listen": "test", "script": { "exec": [ "const jsonData = pm.response.json();\r", "\r", "pm.test(\"Réponse OK\", function ()\r", "{\r", " postman.setNextRequest(null);\r", " pm.expect(jsonData.codeErreur).to.eq(0);\r", " pm.response.to.have.status(200);\r", " postman.setNextRequest(\"Information générales\");\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "token", "value": "{{token}}", "type": "text" } ], "url": { "raw": "{{url}}/{{webApp}}/token/dist/{{codeDistrib}}", "host": [ "{{url}}" ], "path": [ "{{webApp}}", "token", "dist", "{{codeDistrib}}" ] }, "description": "Méthode permettant d'associer un distributeur au token" }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "pm.variables.set(\"webApp\", \"auth/web\");" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }, { "name": "Gestion", "item": [ { "name": "Sociétaire", "item": [ { "name": "Information générales", "event": [ { "listen": "test", "script": { "exec": [ "const jsonData = pm.response.json();\r", "\r", "pm.test(\"Réponse OK\", function () \r", "{\r", " postman.setNextRequest(null);\r", " pm.expect(jsonData.codeErreur).to.eq(0);\r", " pm.response.to.have.status(200);\r", " postman.setNextRequest(\"Adresse\");\r", "});\r", "\r", "pm.test(\"Sociétaire OK\", function () \r", "{\r", " pm.expect(jsonData.contenu.nom).to.contain(\"FOURMI\");\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "token", "value": "{{token}}", "type": "text" } ], "url": { "raw": "{{url}}/{{webApp}}/{{ressource}}/{{codeSocietaire}}", "host": [ "{{url}}" ], "path": [ "{{webApp}}", "{{ressource}}", "{{codeSocietaire}}" ] }, "description": "Méthode permettant de récupérer les informations basiques d'un sociétaire" }, "response": [] }, { "name": "Adresse", "event": [ { "listen": "test", "script": { "exec": [ "const jsonData = pm.response.json();\r", "\r", "pm.test(\"Réponse OK\", function () \r", "{\r", " postman.setNextRequest(null);\r", " pm.expect(jsonData.codeErreur).to.eq(0);\r", " pm.response.to.have.status(200);\r", " postman.setNextRequest(\"Enfants\");\r", "});\r", "\r", "pm.test(\"Adresse OK\", function () \r", "{\r", " pm.expect(jsonData.contenu.codePostal).to.eq(21560);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "token", "value": "{{token}}", "type": "text" } ], "url": { "raw": "{{url}}/{{webApp}}/{{ressource}}/{{codeSocietaire}}/adresse", "host": [ "{{url}}" ], "path": [ "{{webApp}}", "{{ressource}}", "{{codeSocietaire}}", "adresse" ] }, "description": "Méthode permettant de récupérer les informations basiques d'un sociétaire + l'adresse du sociétaire" }, "response": [] }, { "name": "Enfants", "event": [ { "listen": "test", "script": { "exec": [ "const jsonData = pm.response.json();\r", "\r", "pm.test(\"Réponse OK\", function () \r", "{\r", " postman.setNextRequest(null);\r", " pm.expect(jsonData.codeErreur).to.eq(0);\r", " pm.response.to.have.status(200);\r", " postman.setNextRequest(\"Fiche\");\r", "});\r", "\r", "pm.test(\"Enfants OK\", function () \r", "{\r", " pm.expect(jsonData.contenu.enfants.length).to.eq(3);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "token", "value": "{{token}}", "type": "text" } ], "url": { "raw": "{{url}}/{{webApp}}/{{ressource}}/{{codeSocietaire}}/enfants", "host": [ "{{url}}" ], "path": [ "{{webApp}}", "{{ressource}}", "{{codeSocietaire}}", "enfants" ] }, "description": "Méthode permettant de récupérer les informations basiques d'un sociétaire + les enfants du sociétaire" }, "response": [] }, { "name": "Fiche", "event": [ { "listen": "test", "script": { "exec": [ "const jsonData = pm.response.json();\r", "\r", "pm.test(\"Réponse OK\", function () \r", "{\r", " pm.expect(jsonData.codeErreur).to.eq(0);\r", " pm.response.to.have.status(200);\r", "});\r", "\r", "pm.test(\"Fiche OK\", function () \r", "{\r", " pm.expect(jsonData.contenu.typeDocument).to.eq(\"application/pdf\");\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "token", "value": "{{token}}", "type": "text" } ], "url": { "raw": "{{url}}/{{webApp}}/{{ressource}}/{{codeSocietaire}}/fiche", "host": [ "{{url}}" ], "path": [ "{{webApp}}", "{{ressource}}", "{{codeSocietaire}}", "fiche" ] }, "description": "Méthode permettant de récupérer la fiche sociétaire" }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "pm.variables.set(\"ressource\", \"societs\");" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "pm.variables.set(\"webApp\", \"gestion/web\");" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ], "variable": [ { "key": "webApp", "value": "" }, { "key": "token", "value": "" } ] }
Hope you understand me.
The text was updated successfully, but these errors were encountered: