[PR #955] [MERGED] Binary Responses & Response Lenses #2969

Closed
opened 2026-03-17 00:37:36 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/955
Author: @AndrewBastin
Created: 6/21/2020
Status: Merged
Merged: 7/15/2020
Merged by: @AndrewBastin

Base: masterHead: feat/binary-response


📝 Commits (10+)

📊 Changes

28 files changed (+1174 additions, -548 deletions)

View changed files

📝 assets/css/styles.scss (+5 -5)
📝 components/collections/index.vue (+1 -4)
📝 components/environments/editEnvironment.vue (+0 -12)
📝 components/environments/index.vue (+1 -4)
📝 components/layout/history.vue (+2 -2)
components/lenses/ResponseBodyRenderer.vue (+44 -0)
components/lenses/headers.vue (+17 -0)
components/lenses/renderers/HTMLLensRenderer.vue (+153 -0)
components/lenses/renderers/ImageLensRenderer.vue (+102 -0)
components/lenses/renderers/JSONLensRenderer.vue (+149 -0)
components/lenses/renderers/RawLensRenderer.vue (+134 -0)
components/lenses/renderers/XMLLensRenderer.vue (+125 -0)
components/lenses/renderers/mixins/TextContentRendererMixin.js (+10 -0)
directives/textareaAutoHeight.js (+0 -8)
helpers/lenses/htmlLens.js (+8 -0)
helpers/lenses/imageLens.js (+16 -0)
helpers/lenses/jsonLens.js (+8 -0)
helpers/lenses/lenses.js (+37 -0)
helpers/lenses/rawLens.js (+8 -0)
helpers/lenses/xmlLens.js (+8 -0)

...and 8 more files

📄 Description

This PR brings in two major updates to Postwoman both dealing with how we parse responses.

The first major update is the switch to binary responses for data. The current response system expects only string responses and acts really funky for binary responses. The new response system expects data to be stored in pure ArrayBuffer objects. The implementation for this is ongoing and the dependent like the Browser Extensions and Proxywoman are expected to be updated to comply with the system.

The second major update deals with a change in how we present responses. Certain responses, especially those with binary content expect a special way to render contents the current implementation for specializing for different types of contents are not really extensible to allow support for these varied and completely different response types. Hence, a concept of a Response Lens is being introduced, it is simply an extensible mechanism to give certain Content Types to specify a special way to render and allow multiple ways of representation for the same data. The Lens system expects the response data to be represented in the new response system.

This PR intends to fix #929.

Deploy preview: https://deploy-preview-955--postwoman.netlify.app

MVP

  • Basic response parser and renderer
    • RAW
    • JSON
    • HTML
    • XML
    • Image
  • Actions
    • Copy to clipboard / Beautify / Download on RAW / JSON
    • Preview on HTML
    • Preview / Download on Binaries (Image, GIF etc..)
  • Browser extension support
    • Firefox
    • Chrome (implemented on v0.12^)
  • Proxy support @NBTX
  • Beautify / Refactor / Lint code
Site Extension OFF & Poxy OFF Extension ON & Proxy OFF Extension OFF & Proxy ON Extension ON & Poxy ON
Live [x] working [x] working [x] working [ ] failed
#955 [x] working [x] working [x] working [x] working

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/955 **Author:** [@AndrewBastin](https://github.com/AndrewBastin) **Created:** 6/21/2020 **Status:** ✅ Merged **Merged:** 7/15/2020 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `master` ← **Head:** `feat/binary-response` --- ### 📝 Commits (10+) - [`7911d17`](https://github.com/hoppscotch/hoppscotch/commit/7911d17b2f2d118b42d8c236a0b82b6034a98240) Initial lens implementation - [`ac323c9`](https://github.com/hoppscotch/hoppscotch/commit/ac323c99d537a7ae4534e4ef5f9993f25fbc6d31) Fixed activating multiple tabs on initial load - [`923102a`](https://github.com/hoppscotch/hoppscotch/commit/923102a8bf94c235d9ffe193397392339530c829) Fixing CI Build - [`0acb5c6`](https://github.com/hoppscotch/hoppscotch/commit/0acb5c643c8e80da0344e2478900528569e2fd9e) Fixing CI Build - [`b44ba30`](https://github.com/hoppscotch/hoppscotch/commit/b44ba308730c826aa06eefb7ca0fe77192918cf3) Actions for RAW responses - [`e04e82e`](https://github.com/hoppscotch/hoppscotch/commit/e04e82e81ded053b7324391da4d026067878e80c) Actions for JSON responses - [`b227943`](https://github.com/hoppscotch/hoppscotch/commit/b227943fe73131303711f8353aa5f18733c8487a) Actions for HTML responses - [`d81306a`](https://github.com/hoppscotch/hoppscotch/commit/d81306ac1a20654b1aa47e40911340ab6d130f15) Actions for HTML responses - [`bfcb072`](https://github.com/hoppscotch/hoppscotch/commit/bfcb0727d7c7df9044d54f36d0cf12f311e6fcf2) Merge branch 'feat/binary-response' of https://github.com/AndrewBastin/postwoman into feat/binary-response - [`d31da4a`](https://github.com/hoppscotch/hoppscotch/commit/d31da4a0ecba434ce11efb5e4d2a7d1ea81390b0) Removed redundant HTML response type check for preview code ### 📊 Changes **28 files changed** (+1174 additions, -548 deletions) <details> <summary>View changed files</summary> 📝 `assets/css/styles.scss` (+5 -5) 📝 `components/collections/index.vue` (+1 -4) 📝 `components/environments/editEnvironment.vue` (+0 -12) 📝 `components/environments/index.vue` (+1 -4) 📝 `components/layout/history.vue` (+2 -2) ➕ `components/lenses/ResponseBodyRenderer.vue` (+44 -0) ➕ `components/lenses/headers.vue` (+17 -0) ➕ `components/lenses/renderers/HTMLLensRenderer.vue` (+153 -0) ➕ `components/lenses/renderers/ImageLensRenderer.vue` (+102 -0) ➕ `components/lenses/renderers/JSONLensRenderer.vue` (+149 -0) ➕ `components/lenses/renderers/RawLensRenderer.vue` (+134 -0) ➕ `components/lenses/renderers/XMLLensRenderer.vue` (+125 -0) ➕ `components/lenses/renderers/mixins/TextContentRendererMixin.js` (+10 -0) ➖ `directives/textareaAutoHeight.js` (+0 -8) ➕ `helpers/lenses/htmlLens.js` (+8 -0) ➕ `helpers/lenses/imageLens.js` (+16 -0) ➕ `helpers/lenses/jsonLens.js` (+8 -0) ➕ `helpers/lenses/lenses.js` (+37 -0) ➕ `helpers/lenses/rawLens.js` (+8 -0) ➕ `helpers/lenses/xmlLens.js` (+8 -0) _...and 8 more files_ </details> ### 📄 Description This PR brings in two major updates to Postwoman both dealing with how we parse responses. The first major update is the switch to binary responses for data. The current response system expects only string responses and acts really funky for binary responses. The new response system expects data to be stored in pure [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) objects. The implementation for this is ongoing and the dependent like the [Browser Extensions](https://github.com/AndrewBastin/postwoman-extension) and [Proxywoman](https://github.com/postwoman-io/proxywoman) are expected to be updated to comply with the system. The second major update deals with a change in how we present responses. Certain responses, especially those with binary content expect a special way to render contents the current implementation for specializing for different types of contents are not really extensible to allow support for these varied and completely different response types. Hence, a concept of a Response Lens is being introduced, it is simply an extensible mechanism to give certain Content Types to specify a special way to render and allow multiple ways of representation for the same data. The Lens system expects the response data to be represented in the new response system. This PR intends to fix #929. Deploy preview: https://deploy-preview-955--postwoman.netlify.app **MVP** - [x] Basic response parser and renderer - [x] RAW - [x] JSON - [x] HTML - [x] XML - [x] Image - [x] Actions - [x] Copy to clipboard / Beautify / Download on RAW / JSON - [x] Preview on HTML - [x] Preview / Download on Binaries (Image, GIF etc..) - [x] Browser extension support - [x] Firefox - [x] Chrome (implemented on v0.12^) - [x] Proxy support @NBTX - [x] Beautify / Refactor / Lint code | Site | Extension OFF & Poxy OFF | Extension ON & Proxy OFF | Extension OFF & Proxy ON | Extension ON & Poxy ON | | ----------- | ----------- | ----------- | ----------- | ----------- | | [Live](https://postwoman.io/) | [x] working | [x] working | [x] working | [ ] failed | | [#955](https://deploy-preview-955--postwoman.netlify.app/) | [x] working | [x] working | [x] working | [x] working | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 00:37:36 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#2969
No description provided.