Adding placeholder and making sure query urls have a protocol.

This commit is contained in:
mike12345567 2021-12-09 10:02:47 +00:00
parent 80ed9e25f3
commit dad8524023
2 changed files with 5 additions and 5 deletions

View File

@ -176,7 +176,7 @@
/>
</div>
<div class="url">
<Input bind:value={url} />
<Input bind:value={url} placeholder="http://www.api.com/endpoint" />
</div>
<Button cta disabled={!url} on:click={runQuery}>Send</Button>
</div>

View File

@ -146,11 +146,11 @@ module RestModule {
getUrl(path: string, queryString: string): string {
const main = `${path}?${queryString}`
if (!this.config.url) {
return main
} else {
return `${this.config.url}/${main}`
let complete = !this.config.url ? main : `${this.config.url}/${main}`
if (!complete.startsWith("http")) {
complete = `http://${complete}`
}
return complete
}
async _req(query: RestQuery) {