@stoplight/request-maker
TypeScript icon, indicating that this package has built-in type declarations

3.7.0 • Public • Published

@stoplight/request-maker

Maintainability Test Coverage

A set of components used to craft http requests and view their responses.

Request Maker

Getting Started

First of all you need to add the library and all of the peer dependencies:

# Install the request maker
yarn add @stoplight/request-maker

# Install the peer dependencies
yarn add @stoplight/ui-kit mobx prismjs react react-dom @stoplight/prism-http

Usage

In order to manage component state, you need to create an instance of the RequestMakerStore and pass it to the RequestMakerProvider.

You can construct the store from scratch or from an existing http request or http operation.

Here's an example using an http request:

// Initialize the store with request data
const store = new RequestMakerStore({
  request: {
    method: 'get',
    url: 'https://stoplight.io',
  }
});

// Add a content-type header
store.headerParams.push({
  name: 'content-type',
  value: 'application/json',
  isEnabled: true,
});

return (
  <RequestMakerProvider value={store}>
    <RequestEndpoint />

    <RequestEditor />

    <ResponseViewer />
  </RequestMakerProvider>
)

Readme

Keywords

none

Package Sidebar

Install

npm i @stoplight/request-maker

Weekly Downloads

82

Version

3.7.0

License

Apache-2.0

Unpacked Size

190 kB

Total Files

58

Last publish

Collaborators

  • stoplight-devops