Hide download response button for non-JSON responses

This commit is contained in:
Andrew Bastin
2020-06-10 20:05:51 -04:00
parent 6ebcecae80
commit d111e219c2

View File

@@ -973,7 +973,7 @@
class="icon" class="icon"
@click="downloadResponse" @click="downloadResponse"
ref="downloadResponse" ref="downloadResponse"
v-if="response.body" v-if="response.body && canDownloadResponse"
v-tooltip="$t('download_file')" v-tooltip="$t('download_file')"
> >
<i class="material-icons">get_app</i> <i class="material-icons">get_app</i>
@@ -1612,6 +1612,14 @@ export default {
isJSONContentType(this.contentType) isJSONContentType(this.contentType)
) )
}, },
canDownloadResponse() {
return (
this.response &&
this.response.headers &&
this.response.headers["content-type"] &&
isJSONContentType(this.response.headers["content-type"])
)
},
uri: { uri: {
get() { get() {
return this.$store.state.request.uri ? this.$store.state.request.uri : this.url + this.path return this.$store.state.request.uri ? this.$store.state.request.uri : this.url + this.path