question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML getting rendered in the response field

See original GitHub issue

What you did:

Add this HTML snippet inside the response field. And you will see it render…

<div style='width: 500px; background-color: red;'>Hey you!</div>

What happened:

It rendered the HTML

image

Suggested solution:

I think at the moment mockit will only return JSON responses. It would be nice that HTML does not get rendered as HTML, but also maybe give the user an error if HTML was added?

Option 2: We can try and support HTML as responses but not sure what would be involved.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
wohlbencommented, Apr 30, 2019

Hey @samrith-s

@boyney123 left out the --build flag i mentioned in my PR some time ago - that forces docker compose to rebuild the images and consequently updates the code 😃

but hot reloading is also possible by mounting the code from your workstation into the container

looking at the Dockerfile, you should be able to just mount the whole directory into each WORKDIR, so something like this could work… but is untested

version: "3"
services:
  mockit-routes:
    image: "mockit-routes"
    build: "mockit-routes"
    ports:
      - 3000:3000
    volumes:
      - .:/usr/src/mockit-routes
  mockit-server:
    image: "mockit-server"
    build: "server"
    ports:
      - 4000:4000
    volumes:
      - .:/usr/src/mockit-server
  mockit-client:
    image: "mockit-client"
    build: "client"
    ports:
      - 5000:3000
    environment:
      - REACT_APP_MOCKIT_SERVER_URL=http://localhost:3000
      - REACT_APP_MOCKIT_API_URL=http://localhost:4000
    volumes:
      - .:/usr/src/mockit-client

by mounting the whole directory instead of just the routes.json, the used routes json changes from src/config/routes.json to ./configuration/routes.json

ps: feel free to ping me if you have any questions about docker/docker-compose @boyney123, i do have some experience on the topic 😃

0reactions
boyney123commented, May 2, 2019

Thanks for this @wohlben and helping out. I’m going to raise some docs about how people can contribute and get the whole environment setup as I realise it might be the easiest thing to get up and running (to work on)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rendering HTML Pages as an HTTP Server Response ...
We can use the same server to render HTML elements as the server response instead of sending plain text. Here is a list...
Read more >
Rendering html response from API in React
1. Store the html in a useState field after receiving it, and use a useEffect callback to send the request. Currently you're sending...
Read more >
How to render HTML output in hook_ENTITY_TYPE_presave()
So, I want to get the rendered output of the field after running the input filter and save it to the field text_main_display....
Read more >
How browser rendering works — behind the scenes
The purpose of this article is to explain, in very simple terms, the steps your browser takes to convert HTML, CSS, and JavaScript...
Read more >
Populating the page: how browsers work - Web performance
We describe five steps in the critical rendering path. The first step is processing the HTML markup and building the DOM tree. HTML...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found