An element to display the response body

Usage no npm install needed!

<script type="module">
  import advancedRestClientResponseBodyView from 'https://cdn.skypack.dev/@advanced-rest-client/response-body-view';


Published on NPM

Build Status


An element to display a HTTP response body in accessible and human readable form.

<response-body-view responsetext="# Hello world" contenttype="application/markdown"></response-body-view>

Note, the element internally uses TextDecoder class for responses that are an ArrayBuffer instead of text. If the response can be an ArrayBuffer you need to ensure the TextDecoder class is supported / polyfilled.



npm install --save @advanced-rest-client/response-body-view

In an html file

    <script type="module">
      import '@advanced-rest-client/response-body-view/response-body-view.js';
      const view = document.querySelector('response-body-view');
      view.responseText = JSON.stringify({
        data: 'some data'
      view.contentType = 'application/json'

In a LitElement

import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/response-body-view/response-body-view.js';

class SampleElement extends PolymerElement {
  render() {
    return html`
      responsetext="# Hello world"

  _urlClickHandler(e) {
    console.log(`User clicked on ${e.detail.value}`);

  _urlMetaClickHandler(e) {
    console.log(`User clicked on ${e.detail.value} with ctrl or meta`);
customElements.define('sample-element', SampleElement);


git clone https://github.com/advanced-rest-client/response-body-view
cd response-body-view
npm install

Running the demo locally

npm start

Running the tests

npm test

API components

This components is a part of API components ecosystem

Breaking Changes in v3

  • XML custom view has been replaced with Prism syntax highlighting
  • Prism parsing timeout is no longer supported, it wasn't working well anyway
  • Response preview has been removed, it couldn't reliably render response view