Skip to content

Commit

Permalink
Merge branch 'master' into feature/hoppscotch#759
Browse files Browse the repository at this point in the history
  • Loading branch information
sboulema authored May 11, 2020
2 parents 39a7d73 + 5c31cf5 commit d447029
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
28 changes: 19 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 13 additions & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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')`
Expand All @@ -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`)
Expand Down

0 comments on commit d447029

Please sign in to comment.