Skip to content

Commit

Permalink
fix: move request handling to backend; fixes CORS-only headers
Browse files Browse the repository at this point in the history
  • Loading branch information
crowbait committed Dec 14, 2024
1 parent 58e7899 commit 4451e75
Show file tree
Hide file tree
Showing 10 changed files with 304 additions and 196 deletions.
1 change: 0 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ vsc-extension-quickstart.md
src/**
!src/helpers/jsontree.css
!src/helpers/jsontree.js
!src/helpers/statusCodes.jspart
!src/*.html

node_modules
Expand Down
2 changes: 1 addition & 1 deletion src/Call-Temporary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RESTCall_Temporary {
this.log.appendLine(`Running ${this.label}`);
if (this.runView) {
this.runView.webview.reveal();
this.runView.run();
this.runView.prepareRun();
return;
}
this.runView = new CallRun(this, () => this.runView = undefined);
Expand Down
2 changes: 1 addition & 1 deletion src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RESTCall extends ListEntry {
this.provider.log.appendLine(`Running ${this.label}`);
if (this.runView) {
this.runView.webview.reveal();
this.runView.run();
this.runView.prepareRun();
return;
}
this.runView = new CallRun(this, () => this.runView = undefined);
Expand Down
11 changes: 8 additions & 3 deletions src/CallEdit.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,14 @@
border: 1px solid var(--vscode-widget-border);
border-radius: 4px;
}
#body-errors {
color: darkorange;
font-family: var(--vscode-editor-font-family);
background: var(--vscode-textPreformat-background);
padding: 0.25rem;
}

#json-errors, #body-errors {
#json-errors {
color: lightcoral;
font-family: var(--vscode-editor-font-family);
background: darkred;
Expand Down Expand Up @@ -300,7 +306,7 @@ <h3 id="title-sub"></h3>
} catch (error) {
vscode.postMessage({channel: 'err', value: `Error parsing body: ${error.message}`});
body_errors.hidden = false;
body_errors.innerText = error.message;
body_errors.innerText = `Warning: ${error.message}`;
}
}
input_body.onchange = (e) => {
Expand Down Expand Up @@ -349,7 +355,6 @@ <h3 id="title-sub"></h3>
// -----------------
(function() {
window.addEventListener('message', event => {
vscode.postMessage({channel: 'log', value: `Message from host: ${JSON.stringify(event.data)}`});
switch (event.data.channel) {
case 'call-data':
data = event.data.value;
Expand Down
4 changes: 2 additions & 2 deletions src/CallEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export class CallEdit {
webview: vscode.WebviewPanel;

private webviewSendMessage = (message: any): void => {
this.log.appendLine(`Sending to webview edit: ${JSON.stringify(message)}`);
this.log.appendLine(`Sending to webview edit: ${JSON.stringify(message.channel)}`);
this.webview.webview.postMessage(message);
};
private webviewReceiveMessage = (message: any): void => {
this.log.appendLine(`Receiving from webview edit: ${JSON.stringify(message)}`);
this.log.appendLine(`Receiving from webview edit: ${JSON.stringify(message.channel)}`);
switch (message.channel) {
case 'event':
switch (message.value) {
Expand Down
Loading

0 comments on commit 4451e75

Please sign in to comment.