From 764d001ef65815a6fabbf9e8ef706aaef286c488 Mon Sep 17 00:00:00 2001 From: Hydrophobefireman Date: Sun, 10 May 2020 20:44:51 +0530 Subject: [PATCH 1/7] produce valid output when showing/copying code Currently when copying a json request as fetch, it outputs a javascript object instead of a stringified version, which is not valid for a fetch request. --- pages/index.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index a8e110c6c..65a3707fa 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1941,7 +1941,7 @@ export default { requestString.push( `xhr.setRequestHeader('Content-Type', '${this.contentType}; charset=utf-8')` ) - requestString.push(`xhr.send(${requestBody})`) + requestString.push(`xhr.send("${requestBody}")`) } else { requestString.push("xhr.send()") } @@ -1960,7 +1960,13 @@ export default { headers.push(` "Authorization": "Bearer ${this.bearerToken}",\n`) } if (["POST", "PUT", "PATCH"].includes(this.method)) { - const requestBody = this.rawInput ? this.rawParams : this.rawRequestBody + let requestBody = this.rawInput ? this.rawParams : this.rawRequestBody + if (this.contentType.includes("json")) { + requestBody = `JSON.stringify("${requestBody}")`; + } else if (this.contentType.includes("x-www-form-urlencoded")) { + requestBody = `"${requestBody}"`; + } + requestString.push(` body: ${requestBody},\n`) headers.push(` "Content-Length": ${requestBody.length},\n`) headers.push(` "Content-Type": "${this.contentType}; charset=utf-8",\n`) From fec3c309be459c1dc812ea99697cd72fd45ed9c2 Mon Sep 17 00:00:00 2001 From: Hydrophobefireman Date: Sun, 10 May 2020 20:48:12 +0530 Subject: [PATCH 2/7] fix for xhr and keep code style intact --- pages/index.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 65a3707fa..2e9ddb23c 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1936,12 +1936,17 @@ export default { }) } if (["POST", "PUT", "PATCH"].includes(this.method)) { - const requestBody = this.rawInput ? this.rawParams : this.rawRequestBody + let requestBody = this.rawInput ? this.rawParams : this.rawRequestBody + if (this.contentType.includes("json")) { + requestBody = `JSON.stringify("${requestBody}")` + } else if (this.contentType.includes("x-www-form-urlencoded")) { + requestBody = `"${requestBody}"` + } requestString.push(`xhr.setRequestHeader('Content-Length', ${requestBody.length})`) requestString.push( `xhr.setRequestHeader('Content-Type', '${this.contentType}; charset=utf-8')` ) - requestString.push(`xhr.send("${requestBody}")`) + requestString.push(`xhr.send(${requestBody})`) } else { requestString.push("xhr.send()") } @@ -1962,9 +1967,9 @@ export default { if (["POST", "PUT", "PATCH"].includes(this.method)) { let requestBody = this.rawInput ? this.rawParams : this.rawRequestBody if (this.contentType.includes("json")) { - requestBody = `JSON.stringify("${requestBody}")`; + requestBody = `JSON.stringify("${requestBody}")` } else if (this.contentType.includes("x-www-form-urlencoded")) { - requestBody = `"${requestBody}"`; + requestBody = `"${requestBody}"` } requestString.push(` body: ${requestBody},\n`) From e0aede3fc418e8bb38fbac2113ee99bc8cee5cd4 Mon Sep 17 00:00:00 2001 From: Hydrophobefireman Date: Sun, 10 May 2020 21:26:44 +0530 Subject: [PATCH 3/7] Update index.vue --- pages/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 2e9ddb23c..8843c8ee8 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1938,7 +1938,7 @@ export default { if (["POST", "PUT", "PATCH"].includes(this.method)) { let requestBody = this.rawInput ? this.rawParams : this.rawRequestBody if (this.contentType.includes("json")) { - requestBody = `JSON.stringify("${requestBody}")` + requestBody = `JSON.stringify(${requestBody})` } else if (this.contentType.includes("x-www-form-urlencoded")) { requestBody = `"${requestBody}"` } @@ -1967,7 +1967,7 @@ export default { if (["POST", "PUT", "PATCH"].includes(this.method)) { let requestBody = this.rawInput ? this.rawParams : this.rawRequestBody if (this.contentType.includes("json")) { - requestBody = `JSON.stringify("${requestBody}")` + requestBody = `JSON.stringify(${requestBody})` } else if (this.contentType.includes("x-www-form-urlencoded")) { requestBody = `"${requestBody}"` } From 38949bf4b084c833aa258fadfda584429d3d8ea4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 11 May 2020 00:28:57 +0000 Subject: [PATCH 4/7] chore(deps): bump nuxt-i18n from 6.11.0 to 6.11.1 Bumps [nuxt-i18n](https://github.com/nuxt-community/nuxt-i18n) from 6.11.0 to 6.11.1. - [Release notes](https://github.com/nuxt-community/nuxt-i18n/releases) - [Changelog](https://github.com/nuxt-community/nuxt-i18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/nuxt-community/nuxt-i18n/compare/v6.11.0...v6.11.1) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 28 +++++++++++++++++++--------- package.json | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1b4dd04a..71993aef4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1628,9 +1628,19 @@ } }, "@intlify/vue-i18n-extensions": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@intlify/vue-i18n-extensions/-/vue-i18n-extensions-1.0.1.tgz", - "integrity": "sha512-vQRvxZ0GUtL5nezXr6wEjASm/cn6dhnFGq6jF33WDug4q8nm5kzn4imglmRjXVfMrCGmfXqbO12afPGgssStxA==" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@intlify/vue-i18n-extensions/-/vue-i18n-extensions-1.0.2.tgz", + "integrity": "sha512-rnfA0ScyBXyp9xsSD4EAMGeOh1yv/AE7fhqdAdSOr5X8N39azz257umfRtzNT9sHXAKSSzpCVhIbMAkp5c/gjQ==", + "requires": { + "@babel/parser": "^7.9.6" + }, + "dependencies": { + "@babel/parser": { + "version": "7.9.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.6.tgz", + "integrity": "sha512-AoeIEJn8vt+d/6+PXDRPaksYhnlbMIiejioBZvvMQsOjW/JYK6k/0dKnvvP3EhK5GfMBWDPtrxRtegWdAcdq9Q==" + } + } }, "@intlify/vue-i18n-loader": { "version": "1.0.0", @@ -9639,9 +9649,9 @@ } }, "nuxt-i18n": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/nuxt-i18n/-/nuxt-i18n-6.11.0.tgz", - "integrity": "sha512-gavslWFIEezY0IUsmNb5GR25jSgWYoH4XKHUkRNGopDvIGA0+xmNx4kpA1BcWTKM9DVDI2BqXfxIROHy0XGtXQ==", + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/nuxt-i18n/-/nuxt-i18n-6.11.1.tgz", + "integrity": "sha512-nyr53JhHRoF3Ig6slUaXRALtAUOyGbKonL5AcNXxGkRdHpzF9HJ6mZ13W2wZCf2AiH3XatRYEh6GAmwLAOUj3A==", "requires": { "@babel/parser": "^7.5.5", "@babel/traverse": "^7.5.5", @@ -13927,9 +13937,9 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==" }, "vue-i18n": { - "version": "8.17.4", - "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.17.4.tgz", - "integrity": "sha512-wpk/drIkPf6gHCtvHc8zAZ1nsWBZ+/OOJYtJxqhYD6CKT0FJAG5oypwgF9kABt30FBWhl8NEb/QY+vaaBARlFg==" + "version": "8.17.5", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.17.5.tgz", + "integrity": "sha512-gijXwvyTH3aeJhuq8EoQ9SDDlm1mgJexNccSK1ctalxsa6C7ifbWiH7V/YGfm9WJ7udYoD8ezfZdazxxvKvKYw==" }, "vue-loader": { "version": "15.9.1", diff --git a/package.json b/package.json index 970e5350c..defad5b7c 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "graphql": "^14.6.0", "graphql-language-service-interface": "^2.3.3", "nuxt": "^2.12.2", - "nuxt-i18n": "^6.11.0", + "nuxt-i18n": "^6.11.1", "paho-mqtt": "^1.1.0", "socket.io-client": "^2.3.0", "socketio-wildcard": "^2.0.0", From 39a7d73430ff634ae1efda4800f6485c3af66eeb Mon Sep 17 00:00:00 2001 From: "Samir L. Boulema" Date: Mon, 11 May 2020 11:15:42 +0200 Subject: [PATCH 5/7] Allow importing environment variables via Postman environment json files --- .../environments/importExportEnvironment.vue | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/components/environments/importExportEnvironment.vue b/components/environments/importExportEnvironment.vue index 82083cb2b..a6c789ce2 100644 --- a/components/environments/importExportEnvironment.vue +++ b/components/environments/importExportEnvironment.vue @@ -119,15 +119,28 @@ export default { let reader = new FileReader() reader.onload = event => { let content = event.target.result - let environments = JSON.parse(content) - let confirmation = this.$t("file_imported") - this.$store.commit("postwoman/importAddEnvironments", { - environments, - confirmation, - }) + let importFileObj = JSON.parse(content) + if (importFileObj["_postman_variable_scope"] === "environment") { + this.importFromPostman(importFileObj) + } else { + this.importFromPostwoman(importFileObj) + } } reader.readAsText(this.$refs.inputChooseFileToImportFrom.files[0]) }, + importFromPostwoman(environments) { + let confirmation = this.$t("file_imported") + this.$store.commit("postwoman/importAddEnvironments", { + environments, + confirmation, + }) + }, + importFromPostman(importFileObj) { + let environment = { name: importFileObj.name, variables: [] } + importFileObj.values.forEach(element => environment.variables.push({ key: element.key, value: element.value })); + let environments = [ environment ] + this.importFromPostwoman(environments) + }, exportJSON() { let text = this.environmentJson text = text.replace(/\n/g, "\r\n") From 942ef6a7521cf67d965d2371681dd5faacf04679 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 11 May 2020 14:07:13 +0000 Subject: [PATCH 6/7] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4632d760e..93b536c36 100644 --- a/README.md +++ b/README.md @@ -342,7 +342,7 @@ See the [CHANGELOG](CHANGELOG.md) file for details. * ([contributors](https://github.com/liyasthomas/postwoman/graphs/contributors)) ### Collaborators -[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-14-orange.svg?style=flat-square)](#contributors-) @@ -365,6 +365,7 @@ See the [CHANGELOG](CHANGELOG.md) file for details.
Hossein Nedaee

💻
James George

💻
Dmitry Yankowski

💻 +
Samir Boulema

💻 From 1a3ff5dbb78f0cf38597df406481f088b24edca2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 11 May 2020 14:07:14 +0000 Subject: [PATCH 7/7] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0c4cde53e..8abf05d1d 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -123,6 +123,15 @@ "contributions": [ "code" ] + }, + { + "login": "sboulema", + "name": "Samir Boulema", + "avatar_url": "https://avatars2.githubusercontent.com/u/1820661?v=4", + "profile": "http://www.sboulema.nl", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7,