GithubHelp home page GithubHelp logo

isabella232 / httpsnippet-fsless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from postmanlabs/httpsnippet-fsless

0.0 0.0 0.0 513 KB

HTTP Request snippet generator for many languages & libraries

Home Page: https://apiembed.com

License: MIT License

JavaScript 100.00%

httpsnippet-fsless's Introduction

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

# to use in cli
npm install --global httpsnippet

# to use as a module
npm install --save httpsnippet

Usage


  Usage: httpsnippet [options] <file>

  Options:

    -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:

httpsnippet example.json --target node --client unirest --output ./snippets
$ tree snippets
snippets/
└── example.js

process multiple files:

httpsnippet ./*.json --target node --client request --output ./snippets
$ tree snippets/
snippets/
├── endpoint-1.js
├── endpoint-2.js
└── endpoint-3.js

API

HTTPSnippet(source)

source

Required
Type: object

Name of conversion target

var httpsnippet = require('httpsnippet');

var snippet = new HTTPSnippet({
  method: 'GET',
  url: 'http://mockbin.com/request'
});

convert(target [, options])

target

Required
Type: string

Name of conversion target

options

Type: object

Target options, see wiki for details

var httpsnippet = require('httpsnippet');

var snippet = new HTTPSnippet({
  method: 'GET',
  url: 'http://mockbin.com/request'
});

// generate Node.js: Native output
console.log(snippet.convert('node'));

// generate Node.js: Native output, indent with tabs
console.log(snippet.convert('node', {
  indent: '\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

var httpsnippet = require('httpsnippet');

var snippet = new HTTPSnippet({
  method: 'GET',
  url: 'http://mockbin.com/request'
});

// generate Shell: cURL output
console.log(snippet.convert('shell', 'curl', {
  indent: '\t';
}));

// generate Node.js: Unirest output
console.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:

  • Breaking backward compatibility bumps the major while resetting minor and patch
  • New additions without breaking backward compatibility bumps the minor while resetting the patch
  • Bug fixes and misc changes bumps only the patch

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

License

MIT © Mashape

httpsnippet-fsless's People

Contributors

abhijitkane avatar abhijitpostman avatar ankitjaggi avatar deepakpathania avatar jkbrzt avatar jpadilla avatar kunagpal avatar prakharjoshi avatar samvelraja avatar shashiranjan84 avatar sonicaghi avatar therebelrobot avatar thibaultcha avatar vegetableman avatar wilder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.