diff --git a/README.md b/README.md
index 01e211e3..67ce43df 100644
--- a/README.md
+++ b/README.md
@@ -113,8 +113,13 @@ See the [CHANGELOG](CHANGELOG.md) file for details.
* [Liyas Thomas](https://github.com/liyasthomas)
### Contributors
+* [NBTX](https://github.com/NBTX)
* [Andrew Bastin](https://github.com/AndrewBastin)
+* [Nick Palenchar](https://github.com/nickpalenchar)
* [Abraham Williams](https://github.com/abraham)
+* [Nicholas La Roux](https://github.com/larouxn)
+* [RifqiAlAbqary](https://github.com/reefqi037)
+* [izerozlu](https://github.com/izerozlu)
### Thanks
* [Dribbble](https://dribbble.com)
diff --git a/pages/index.vue b/pages/index.vue
index ab63fb25..fe73369a 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -36,34 +36,42 @@
+
+
+
+
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
+
+
+
@@ -216,6 +224,8 @@
bearerToken: '',
params: [],
bodyParams: [],
+ rawParams: '',
+ rawInput: false,
contentType: 'application/json',
response: {
status: '',
@@ -332,7 +342,7 @@
xhr.setRequestHeader('Authorization', 'Bearer ' + this.bearerToken);
}
if (this.method === 'POST' || this.method === 'PUT') {
- const requestBody = this.rawRequestBody
+ const requestBody = this.rawInput ? this.rawParams : this.rawRequestBody;
xhr.setRequestHeader('Content-Length', requestBody.length)
xhr.setRequestHeader('Content-Type', `${this.contentType}; charset=utf-8`)
xhr.send(requestBody)
@@ -373,11 +383,35 @@
removeRequestBodyParam(index) {
this.bodyParams.splice(index, 1)
},
- copyResponse() {
+ formatRawParams(event) {
+ if ((event.which !== 13 && event.which !== 9)) {
+ return;
+ }
+ const textBody = event.target.value;
+ const textBeforeCursor = textBody.substring(0, event.target.selectionStart);
+ const textAfterCursor = textBody.substring(event.target.selectionEnd);
+
+ if (event.which === 13) {
+ event.preventDefault();
+ const oldSelectionStart = event.target.selectionStart;
+ const lastLine = textBeforeCursor.split('\n').slice(-1)[0];
+ const rightPadding = lastLine.match(/([\s\t]*).*/)[1] || "";
+ event.target.value = textBeforeCursor + '\n' + rightPadding + textAfterCursor;
+ setTimeout(() => event.target.selectionStart = event.target.selectionEnd = oldSelectionStart + rightPadding.length + 1, 1);
+ }
+ else if (event.which === 9) {
+ event.preventDefault();
+ const oldSelectionStart = event.target.selectionStart;
+ event.target.value = textBeforeCursor + '\xa0\xa0' + textAfterCursor;
+ event.target.selectionStart = event.target.selectionEnd = oldSelectionStart + 2;
+ return false;
+ }
+
+ },
+ copyResponse() {
var copyText = document.getElementById("response-details");
copyText.select();
document.execCommand("copy");
- }
}
}