Skip to content

Commit 45c97e5

Browse files
committed
fixes #353 #354 - remove cache-control header from request and improve tag-input control
1 parent 0a17a63 commit 45c97e5

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/components/api-request.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export default class ApiRequest extends LitElement {
5959
activeResponseTab: { type: String }, // internal tracking of response-tab not exposed as a attribute
6060
selectedRequestBodyType: { type: String, attribute: 'selected-request-body-type' }, // internal tracking of selected request-body type
6161
selectedRequestBodyExample: { type: String, attribute: 'selected-request-body-example' }, // internal tracking of selected request-body example
62+
renderedOnce: { type: Boolean },
6263
};
6364
}
6465

@@ -282,7 +283,7 @@ export default class ApiRequest extends LitElement {
282283
data-param-serialize-explode = "${paramExplode}"
283284
data-array = "true"
284285
placeholder= "add-multiple ⮐"
285-
.value = "${exampleVal}"
286+
value = "${Array.isArray(exampleVal) ? exampleVal.join(',') : exampleVal}"
286287
>
287288
</tag-input>`
288289
: paramSchema.type === 'object'
@@ -654,7 +655,7 @@ export default class ApiRequest extends LitElement {
654655
data-example = "${Array.isArray(fieldSchema.example) ? fieldSchema.example.join('~|~') : fieldSchema.example || ''}"
655656
data-array = "true"
656657
placeholder = "add-multiple &#x2b90;"
657-
.value = "${fieldSchema.example || ''}"
658+
value = "${Array.isArray(fieldSchema.example) ? fieldSchema.example.join(',') : fieldSchema.example}"
658659
>
659660
</tag-input>
660661
`
@@ -1170,9 +1171,6 @@ export default class ApiRequest extends LitElement {
11701171
curlHeaders += ` -H "Content-Type: ${requestBodyType}" \\\n`;
11711172
}
11721173

1173-
fetchOptions.headers['Cache-Control'] = 'no-cache';
1174-
curlHeaders += ' -H "Cache-Control: no-cache" \\\n';
1175-
11761174
me.responseUrl = '';
11771175
me.responseHeaders = '';
11781176
// me.responseText = '';

src/components/tag-input.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class TagInput extends LitElement {
99
? html`${this.value.map((v) => html`<span class='tag'> ${v} </span>`)}`
1010
: ''
1111
}
12-
<input type="text" class='editor' @paste="${this.afterPaste}" @keydown="${this.afterKeyDown}" placeholder="${this.placeholder}">
12+
<input type="text" class='editor' @paste="${this.afterPaste}" @keydown="${this.afterKeyDown}" placeholder="${this.placeholder || ''}">
1313
</div>
1414
`;
1515
}
@@ -22,6 +22,15 @@ export default class TagInput extends LitElement {
2222
};
2323
}
2424

25+
attributeChangedCallback(name, oldVal, newVal) {
26+
if (name === 'value') {
27+
if (newVal && oldVal !== newVal) {
28+
const tmpVal = newVal.split(',').filter((v) => v.trim() !== '');
29+
this.value = tmpVal || '';
30+
}
31+
}
32+
}
33+
2534
afterPaste(e) {
2635
const clipboardData = e.clipboardData || window.clipboardData;
2736
const pastedData = clipboardData.getData('Text');

0 commit comments

Comments
 (0)