Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@stoplight/httpsnippet
Advanced tools
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
# to use in cli
npm install --global httpsnippet
# to use as a module
npm install --save httpsnippet
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
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
Required
Type: object
Name of conversion target
var HTTPSnippet = require('httpsnippet');
var snippet = new HTTPSnippet({
method: 'GET',
url: 'http://mockbin.com/request'
});
Required
Type: string
Name of conversion target
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'
}));
Required
Type: string
Name of conversion target
Type: string
Name of conversion target client library
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'));
Required
Type: object
Representation of a conversion target. Can use this to use targets that are not officially supported.
const customLanguageTarget = require('httpsnippet-for-my-lang');
HTTPSnippet.addTarget(customLanguageTarget);
Required
Type: string
Name of conversion target
Required
Type: object
Representation of a conversion target client. Can use this to use target clients that are not officially supported.
const customClient = require('httpsnippet-for-my-node-http-client');
HTTPSnippet.addTargetClient('node', customClient);
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.
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.
Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.
For info on creating new conversion targets, please review this guideline
Moreover, 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.
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/.
FAQs
HTTP Request snippet generator for *most* languages
The npm package @stoplight/httpsnippet receives a total of 0 weekly downloads. As such, @stoplight/httpsnippet popularity was classified as not popular.
We found that @stoplight/httpsnippet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 25 open source maintainers collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.