Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add response previewer for text/html #155

Open
ashitaprasad opened this issue Feb 22, 2024 · 10 comments
Open

Add response previewer for text/html #155

ashitaprasad opened this issue Feb 22, 2024 · 10 comments
Labels
enhancement New feature or request good first issue Good for newcomers mimetype-previewer Response Previewer for different mime-types

Comments

@ashitaprasad
Copy link
Member

Tell us about the task you want to perform and are unable to do so because the feature is not available

Users should be able to see rendered HTML in response preview.

@ashitaprasad ashitaprasad added enhancement New feature or request good first issue Good for newcomers mimetype-previewer Response Previewer for different mime-types labels Feb 22, 2024
@ashitaprasad ashitaprasad changed the title Add response preview for text/html Add response previewer for text/html Feb 22, 2024
@PCoder23
Copy link
Contributor

hi, can i work on this issue ?

@ashitaprasad
Copy link
Member Author

Sure @PCoder23, you can send across a PR so that we can discuss on it further.

@PCoder23
Copy link
Contributor

sure.

@animator
Copy link
Member

animator commented Feb 24, 2024

Some more details on the issue and what has to be accomplished👇

Screenshot 2024-02-24 at 9 09 01 AM

@animator animator linked a pull request Feb 25, 2024 that will close this issue
@ashitaprasad ashitaprasad linked a pull request Mar 5, 2024 that will close this issue
5 tasks
@YoussefMoRabie
Copy link
Contributor

Hi @animator @ashitaprasad
I want to work on this
Can I use webview_universal?

@animator
Copy link
Member

@Yousef-Rabia you can use it, if it works.

@chetanr25
Copy link

I have implemented the HTML rendering using the webview_flutter package. This allows the response to be viewed in the pane as if it were a web browser, with full interactivity—users can interact with the content just like they would in a normal browser.

While this approach renders most of the content accurately (similar to Postman), one limitation is that images are not being rendered correctly. Aside from that, it’s very close to what you would expect in Postman’s "Preview" tab.

I have attach screenshots showing the comparison between our application and Postman while previewing an API response.

Screenshots

Postman Screenshot App Screenshot

Video Explanation

Below is a video demonstrating how the webview_flutter package allows us to render the response fully, just like a regular web browser. You can see the interactivity in action:

ScreenRecording_10-13-2024.16-39-50_1.MP4

Looking forward to your feedback, and let me know if this approach works, or if there are other suggestions to improve it.

@chetanr25
Copy link

@ashitaprasad Just following up on my previous implementation. Does this solution align with the direction you're looking for?

One key advantage of the current implementation, using webview_flutter, is that it provides full browser-like interactivity, which surpasses what Postman offers. While Postman allows you to render HTML in a Preview tab, it remains a static view, limiting user interaction.

In contrast, with this approach, we can now fully render HTML responses with the ability to interact with the content dynamically, just like in a regular web browser. Users can follow links, submit forms, and navigate between pages seamlessly within the response pane. This adds a whole new dimension to debugging and exploring API responses, especially for complex HTML content.

Given these additional capabilities, I would appreciate feedback and confirmation on whether I can move forward with this and make a PR. Let me know if this is in line with the project’s goals!

@ashitaprasad
Copy link
Member Author

@chetanr25 The current approach is incorrect as you have added a new Preview tab beside Response Body and Headers which is redundant. We already have Preview option inside Response Body which was built to render previewer based on response content type. Currently, it shows formatted HTML. In case webview works that will be shown here.
webview_flutter is currently supported only for ios/android/macos you will have to switch between webview and formatted HTML code view based on the platform.
Also, when using webview passing the HTML body will not render the correct view (images are not loaded), you will have to pass the full URL to render it in webview.
Also, currently there is some issue with scrolling in desktop version.

@chetanr25
Copy link

Thank you for the feedback. Will work in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers mimetype-previewer Response Previewer for different mime-types
Projects
None yet
5 participants