Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flawiddsouza/httpsnippet-browser
https://github.com/flawiddsouza/httpsnippet-browser
Last synced: about 11 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/flawiddsouza/httpsnippet-browser
- Owner: flawiddsouza
- License: mit
- Created: 2023-10-23T19:11:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-17T04:01:45.000Z (10 months ago)
- Last Synced: 2024-10-12T13:12:59.268Z (about 1 month ago)
- Language: JavaScript
- Size: 158 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Install
```sh
npm install https://github.com/flawiddsouza/httpsnippet-browser
```## Usage
```js
import { HTTPSnippet } from 'httpsnippet-browser'const har = {
method: 'POST',
url: 'https://postman-echo.com/post',
headers: [
{
name: 'Content-Type',
value: 'application/json'
}
],
postData: {
mimeType: 'application/json',
text: '{"foo": "bar"}'
}
}const snippet = new HTTPSnippet(har)
const output = snippet.convert('shell', 'curl', {
indent: ' '
})console.log(output)
// curl --request POST \
// --url https://postman-echo.com/post \
// --header 'Content-Type: application/json' \
// --data '{"foo": "bar"}'
```