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,
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
-[](#contributors-)
+[](#contributors-)
@@ -365,6 +365,7 @@ See the [CHANGELOG](CHANGELOG.md) file for details.
 Hossein Nedaee 💻 |
 James George 💻 |
 Dmitry Yankowski 💻 |
+  Samir Boulema 💻 |
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")
diff --git a/package-lock.json b/package-lock.json
index c43858aeb..e6434acbd 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",
@@ -9655,9 +9665,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",
@@ -13943,9 +13953,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 8c13cab04..5b1e055a2 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",
diff --git a/pages/index.vue b/pages/index.vue
index a8e110c6c..8843c8ee8 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -1936,7 +1936,12 @@ 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')`
@@ -1960,7 +1965,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`)