Skip to content

This is a plugin used on the browser side to convert curl commands into har objects

License

Notifications You must be signed in to change notification settings

Apipost-Team/web-curl-to-har

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web-curl-to-har

This is a plugin used on the browser side to convert curl commands into har objects

usage

import webCurlToHar, { setConfig } from 'web-curl-to-har';

if (isElectron()) {
  if (process.env.NODE_ENV === 'development') {
    setConfig('./');
  } else {
    setConfig(window?.path.join(window.__dirname, './build/'));
  }
} else {
  setConfig('./');
}

const handleCurl2Har=()=>{
      const curl= `curl 'http://www.apipost.cn/' `
      const curlData = webCurlToHar(curl);
      console.log(curlData);
}


/*
logs:
[{"request":{"method":"GET","url":"http://www.apipost.cn/","httpVersion":"HTTP/1.1","cookies":[],"headers":[],"queryString":[],"headersSize":-1,"bodySize":-1}}]
*/

About

This is a plugin used on the browser side to convert curl commands into har objects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published