Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Code snippets to display a snippets of making a HTTP request

License

Notifications You must be signed in to change notification settings

arc-archive/http-code-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Published on NPM

<http-code-snippets>

Code snippets to render code implementation examples for a HTTP request.

Example

<http-code-snippets url="https://api.github.com/authorizations" method="POST" payload='{"scopes": ["public_repo"]}'></http-code-snippets>

Usage

Installation

npm install --save @advanced-rest-client/http-code-snippets

In an html file

<html>
  <head>
    <script type="module">
      import './node_modules/@advanced-rest-client/http-code-snippets/http-code-snippets.js';
    </script>
  </head>
  <body>
    <http-code-snippets url="https://api.github.com/authorizations" method="POST" payload='{"scopes": ["public_repo"]}'></http-code-snippets>
  </body>
</html>

In a LitElement

import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/http-code-snippets/http-code-snippets.js';

class SampleElement extends PolymerElement {
  render() {
    const {
      url,
      method,
      headers,
      payload
    } = this;
    return html`
    <http-code-snippets
      .url="${url}"
      .method="${method}"
      .headers="${headers}"
      .payload="${payload}"></http-code-snippets>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/advanced-rest-client/http-code-snippets
cd http-code-snippets
npm install

Running the demo locally

npm start

Running the tests

npm test

API components

This component is a part of API components ecosystem