HTTP-Shortcuts icon indicating copy to clipboard operation
HTTP-Shortcuts copied to clipboard

Display modified HTML reponse

Open 77-77SP opened this issue 1 year ago • 2 comments

I would like to propose a new feature that would make it possible to display modified HTML string. I can be done by adding a new scripting function under User Interaction which would take the modified response or any vaild HTML code as an argument and display it inside the existing response component.

The current alternative use showDialog which isn't the most optimal way since it only displays text and has limited formatting features.

Thank you for your time and for this amazing app <3

77-77SP avatar Aug 19 '24 13:08 77-77SP

Thanks for your request. This is already somewhat possible, albeit a bit of a workaround. Here's what you can try:

  1. Open the shortcut editor (for a regular HTTP shortcut)
  2. In "Response Handling", change "On Success" to "Show a message"
  3. In the "Message" field, insert a placeholder for a static variable (let's call it myCustomResponse)
  4. Click "Display Settings" and on the screen that opens change "Message Type" to "HTML".
  5. Go back to the editor overview screen
  6. Open the Scripting screen and in the "Run on Success" field, enter code that modifies the response in the way you want and then stores the result into your variable. Here's an example:
const input = response.body;
const output = input.toUpperCase(); // your custom logic here
setVariable("myCustomResponse", output);

I know this isn't ideal and definitely quite hidden, but hopefully it solves your issue. I'll see that I can make this easier to use in the future.

Waboodoo avatar Aug 20 '24 18:08 Waboodoo

Thank you from the bottom of my heart. I really appreciate your hard work and support. Works as intended.

One note I would add, for future reference (if anyone else is interested), is that the Display Type in Response Handling should be changed to Fullscreen Window to display HTML correctly.

77-77SP avatar Aug 20 '24 18:08 77-77SP