postmanlabs/httpsnippet-fsless

Name: httpsnippet-fsless

Owner: Postman

Description: HTTP Request snippet generator for many languages & libraries

Created: 2015-04-08 10:30:51.0

Updated: 2018-03-17 12:31:39.0

Pushed: 2017-12-16 07:53:33.0

Homepage: https://apiembed.com

Size: 505

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

HTTP Snippet version License

HTTP Request snippet generator for many languages & tools including: cURL, HTTPie, Javascript, Node, C, Java, PHP, Objective-C, Swift, Python, Ruby, C#, Go, OCaml and more!

Relies on the popular HAR format to import data and describe HTTP calls.

See it in action on companion service: APIembed

Build Status Downloads Code Climate Coverage Status Dependencies

Install
 use in cli
install --global httpsnippet

 use as a module
install --save httpsnippet
Usage
age: httpsnippet [options] <file>

tions:

-h, --help                output usage information
-V, --version             output the version number
-t, --target <target>     target output
-c, --client [client]     target client library
-o, --output <directory>  write output to directory
-n, --output-name <name>  output file name
Example

process single file: example.json in HAR Request Object format, or full HAR log format:

snippet example.json --target node --client unirest --output ./snippets
hell
ee snippets
pets/
example.js

process multiple files:

snippet ./*.json --target node --client request --output ./snippets
hell
ee snippets/
pets/
endpoint-1.js
endpoint-2.js
endpoint-3.js
API
HTTPSnippet(source)
source

Required
Type: object

Name of conversion target

httpsnippet = require('httpsnippet');

snippet = new HTTPSnippet({
thod: 'GET',
l: 'http://mockbin.com/request'

convert(target [, options])
target

Required
Type: string

Name of conversion target

options

Type: object

Target options, see wiki for details

httpsnippet = require('httpsnippet');

snippet = new HTTPSnippet({
thod: 'GET',
l: 'http://mockbin.com/request'


enerate Node.js: Native output
ole.log(snippet.convert('node'));

enerate Node.js: Native output, indent with tabs
ole.log(snippet.convert('node', {
dent: '\t';

convert(target [, client, options])
target

Required
Type: string

Name of conversion target

client

Type: string

Name of conversion target client library

options

Type: object

Target options, see wiki for details

httpsnippet = require('httpsnippet');

snippet = new HTTPSnippet({
thod: 'GET',
l: 'http://mockbin.com/request'


enerate Shell: cURL output
ole.log(snippet.convert('shell', 'curl', {
dent: '\t';


enerate Node.js: Unirest output
ole.log(snippet.convert('node', 'unirest'));
Documentation

At the heart of this module is the HAR Format as the HTTP request description format, please review some of the sample JSON HAR Request objects in test fixtures, or read the HAR Docs for more details.

For detailed information on each target, please review the wiki.

Bugs and feature requests

Have a bug or a feature request? Please first read the issue guidelines and search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue.

Contributing

Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.

For a info on creating new conversion targets, please review this guideline

More over, if your pull request contains JavaScript patches or features, you must include relevant unit tests.

Editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at http://editorconfig.org.

Versioning

For transparency into our release cycle and in striving to maintain backward compatibility, this project is maintained under the Semantic Versioning guidelines. Sometimes we screw up, but we'll adhere to these rules whenever possible.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

For more information on SemVer, please visit http://semver.org/.

License

MIT © Mashape


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.