Remove redudant content type prop for HTML Lens
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
</i>
|
</i>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="response.body && responseType === 'text/html'"
|
v-if="response.body"
|
||||||
class="icon"
|
class="icon"
|
||||||
@click.prevent="togglePreview"
|
@click.prevent="togglePreview"
|
||||||
v-tooltip="{
|
v-tooltip="{
|
||||||
@@ -95,11 +95,6 @@ export default {
|
|||||||
previewEnabled: false,
|
previewEnabled: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
responseType() {
|
|
||||||
return (this.response.headers["content-type"] || "").split(";")[0].toLowerCase()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
ToggleExpandResponse() {
|
ToggleExpandResponse() {
|
||||||
this.expandResponse = !this.expandResponse
|
this.expandResponse = !this.expandResponse
|
||||||
@@ -107,7 +102,7 @@ export default {
|
|||||||
},
|
},
|
||||||
downloadResponse() {
|
downloadResponse() {
|
||||||
const dataToWrite = this.responseBodyText
|
const dataToWrite = this.responseBodyText
|
||||||
const file = new Blob([dataToWrite], { type: this.responseType })
|
const file = new Blob([dataToWrite], { type: "text/html" })
|
||||||
const a = document.createElement("a")
|
const a = document.createElement("a")
|
||||||
const url = URL.createObjectURL(file)
|
const url = URL.createObjectURL(file)
|
||||||
a.href = url
|
a.href = url
|
||||||
@@ -144,10 +139,7 @@ export default {
|
|||||||
if (this.previewEnabled) {
|
if (this.previewEnabled) {
|
||||||
if (this.$refs.previewFrame.getAttribute("data-previewing-url") === this.url) return
|
if (this.$refs.previewFrame.getAttribute("data-previewing-url") === this.url) return
|
||||||
// Use DOMParser to parse document HTML.
|
// Use DOMParser to parse document HTML.
|
||||||
const previewDocument = new DOMParser().parseFromString(
|
const previewDocument = new DOMParser().parseFromString(this.responseBodyText, "text/html")
|
||||||
this.responseBodyText,
|
|
||||||
this.responseType
|
|
||||||
)
|
|
||||||
// Inject <base href="..."> tag to head, to fix relative CSS/HTML paths.
|
// Inject <base href="..."> tag to head, to fix relative CSS/HTML paths.
|
||||||
previewDocument.head.innerHTML =
|
previewDocument.head.innerHTML =
|
||||||
`<base href="${this.url}">` + previewDocument.head.innerHTML
|
`<base href="${this.url}">` + previewDocument.head.innerHTML
|
||||||
|
|||||||
Reference in New Issue
Block a user