Merge branch 'feat/binary-response' of https://github.com/AndrewBastin/postwoman into feat/binary-response

This commit is contained in:
Liyas Thomas
2020-06-22 14:27:53 +05:30
3 changed files with 13 additions and 23 deletions

View File

@@ -151,10 +151,6 @@ export default {
togglePreview() { togglePreview() {
this.previewEnabled = !this.previewEnabled this.previewEnabled = !this.previewEnabled
if (this.previewEnabled) { if (this.previewEnabled) {
// If you want to add 'preview' support for other response types,
// just add them here.
if (this.responseType === "text/html") {
// If the preview already has that URL loaded, let's not bother re-loading it all.
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(
@@ -168,7 +164,6 @@ export default {
this.$refs.previewFrame.srcdoc = previewDocument.documentElement.outerHTML this.$refs.previewFrame.srcdoc = previewDocument.documentElement.outerHTML
this.$refs.previewFrame.setAttribute("data-previewing-url", this.url) this.$refs.previewFrame.setAttribute("data-previewing-url", this.url)
} }
}
}, },
}, },
} }

View File

@@ -19,7 +19,6 @@ export default {
response: { response: {
immediate: true, immediate: true,
handler(newValue) { handler(newValue) {
console.log("wetch")
this.imageSource = "" this.imageSource = ""
const buf = this.response.body const buf = this.response.body
@@ -28,7 +27,6 @@ export default {
const reader = new FileReader() const reader = new FileReader()
reader.onload = (e) => { reader.onload = (e) => {
console.log(e.target.result)
this.imageSource = e.target.result this.imageSource = e.target.result
} }
reader.readAsDataURL(blob) reader.readAsDataURL(blob)
@@ -37,17 +35,14 @@ export default {
}, },
mounted() { mounted() {
console.log("mount")
this.imageSource = "" this.imageSource = ""
console.log(this.response)
const buf = this.response.body const buf = this.response.body
const bytes = new Uint8Array(buf) const bytes = new Uint8Array(buf)
const blob = new Blob([bytes.buffer]) const blob = new Blob([bytes.buffer])
const reader = new FileReader() const reader = new FileReader()
reader.onload = (e) => { reader.onload = (e) => {
console.log(e.target.result)
this.imageSource = e.target.result this.imageSource = e.target.result
} }
reader.readAsDataURL(blob) reader.readAsDataURL(blob)

View File

@@ -952,7 +952,7 @@
/> />
</li> </li>
</ul> </ul>
<div v-if="response.body"> <div v-if="response.body && response.body !== $t('loading')">
<response-renderer :response="response" /> <response-renderer :response="response" />
</div> </div>
<!-- <!--