Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@readme/oas-to-har

Package Overview
Dependencies
Maintainers
12
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@readme/oas-to-har

Utility to transform an OAS operation into a HAR representation

  • 24.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
56K
decreased by-0.77%
Maintainers
12
Weekly downloads
 
Created
Source

@readme/oas-to-har

Utility to transform an OAS operation into a HAR representation

Build

Installation

npm install --save @readme/oas-to-har

Usage

import Oas from 'oas';
import oasToHar from '@readme/oas-to-har';

import petstore from './petstore.json';

const spec = new Oas(petstore);
console.log(oasToHar(spec, spec.operation('/pets', 'post')));
{
  "log": {
    "entries": [
      {
        "request": {
          "cookies": [],
          "headers": [],
          "headersSize": 0,
          "queryString": [],
          "bodySize": 0,
          "method": "POST",
          "url": "http://petstore.swagger.io/v2/pets",
          "httpVersion": "HTTP/1.1"
        }
      }
    ]
  }
}

oasToHar(oas, operationSchema, values, auth, opts) => Object

  • oas {Oas}: Instance of our oas/tooling class.
  • operationSchema {Object|Operation}: Can either be an object with path and method properties (that exist in the supplied OAS), or an instance of our Operation class from oas/tooling - accessed through new Oas(spec).operation(path, method).
  • values {Object}: A object of payload data, with key-value data therein, that should be used to construct the request. Available data you can define here:
    • path
    • query
    • body
    • cookie
    • formData
    • header
    • server — If the supplied OAS has multiple severs or server variables you can use this to set which server and variables to use. Shape of it should be: { selected: Integer, variables: { ...key-values }}. selected should coorespond to index of the servers array in your OAS.
  • auth {Object}: Authentication information for the request.
  • opts.proxyUrl {Boolean}: Boolean to toggle if composed HAR objects should have their url be sent through our CORS-friendly proxy. Defaults to false.

FAQs

Package last updated on 18 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc