Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
httpsnippet
Advanced tools
HTTP Request snippet generator for most languages.
Relies on the popular HAR format to import data and describe HTTP calls.
currently the following output targets are supported:
install from source or through npm:
# to use in cli
npm install --global httpsnippet
# to use as a module
npm install httpsnippet
Usage: httpsnippet [options] <file>
Options:
-h, --help output usage information
-V, --version output the version number
-t, --target <target> target output
-o, --output <directory> write output to directory
-n, --output-name <name> output file name
process single file:
httpsnippet my-api-endpoint.json --langauge php --output ./snippets
$ tree snippets
snippets/
└── my-api-endpoint.php
process multiple files:
httpsnippet /*.json --langauge nodejs --output ./snippets
$ tree sources/
sources/
├── endpoint-1.json
├── endpoint-2.json
└── endpoint-3.json
$ tree snippets/
snippets/
├── endpoint-1.js
├── endpoint-2.js
└── endpoint-3.js
var httpsnippet = require('httpsnippet');
var snippet = new httpsnippet({
method: 'GET',
url: 'http://httpconsole.com/echo'
});
// generate cURL output
console.log(snippet.convert('curl', {
indent: '\t';
}));
// generate nodeJS output
console.log(snippet.convert('node'));
// generate PHP output
console.log(snippet.convert('php', 'curl'));
At the heart of this module is the HAR Request object 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.
output targets are simple modules that expose a constructor (which handles the transformation) and a utility info
method
module.exports = function (opts) {
// optionally process `opts` object for target specific configuration
//
// process `this.source` object
//
// return processed output as string
};
module.exports.info = function () {
// return target info
return {
family: 'node', // target family
key: 'native', // target key
ext: '.js', // preferred extension
title: '', // target label
description: '' // target description
};
};
Option | Default | Description |
---|---|---|
short | false | use short form of cURL CLI options |
indent | | line break & indent output value, set to false to disable line breaks |
Option | Default | Description |
---|---|---|
body | false | only the response body is printed |
headers | false | only the response headers are printed |
verbose | false | print the whole HTTP exchange (request and response) |
print | false | selects parts of the HTTP exchange, e.g. --print=Hh (see httpie docs) |
cert | false | use a client side certificate (see httpie docs) |
verify | false | server SSL certificate verification (see httpie docs) |
pretty | false | syntax highlighting (see httpie docs) |
style | false | syntax highlighting (see httpie docs) |
timeout | false | overwrite the default 30s timeout |
short | false | use short form of cURL CLI options |
indent | | line break & indent output value, set to false to disable line breaks |
Option | Default | Description |
---|---|---|
short | false | use short form of cURL CLI options |
indent | | line break & indent output value, set to false to disable line breaks |
verbose | false | by default, --quiet is always used, unless verbose is set to true |
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.
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.
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/.
Licensed under The MIT License.
FAQs
HTTP Request snippet generator for *most* languages
The npm package httpsnippet receives a total of 32,748 weekly downloads. As such, httpsnippet popularity was classified as popular.
We found that httpsnippet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.