Socket
Socket
Sign inDemoInstall

httpsnippet

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpsnippet - npm Package Compare versions

Comparing version 1.0.0-beta.8 to 1.0.0-beta.9

src/targets/node/request.js

2

package.json
{
"version": "1.0.0-beta.8",
"version": "1.0.0-beta.9",
"name": "httpsnippet",

@@ -4,0 +4,0 @@ "description": "HTTP Request snippet generator for *most* languages",

'use strict';
var util = require('util');
var reducer = require('.,/../../reducer');
var reducer = require('../../reducer');

@@ -66,6 +66,15 @@ module.exports = function (options) {

if (!this.source.postData.text && this.source.postData.params) {
var postData = this.source.postData.params.reduce(reducer, {});
if (this.source.postData.mimeType === 'application/x-www-form-urlencoded') {
var postData = this.source.postData.params.reduce(reducer, {});
code.push(util.format('var postData = querystring.stringify(%s);', JSON.stringify(postData)));
code.push(util.format('req.write(postData);'));
code.push(util.format('var postData = querystring.stringify(%s);', JSON.stringify(postData)));
code.push(util.format('req.write(postData);'));
}
if (this.source.postData.mimeType === 'multipart/form-data') {
postData = this.source.postData.params.reduce(reducer, {});
code.push(util.format('var postData = querystring.stringify(%s);', JSON.stringify(postData)));
code.push(util.format('req.write(postData);'));
}
}

@@ -72,0 +81,0 @@

'use strict';
var util = require('util');
module.exports = function (options) {
var opts = util._extend({
timeout: '10'
}, options);
var code = [];

@@ -14,3 +20,3 @@

code.push(' cachePolicy:NSURLRequestUseProtocolCachePolicy');
code.push(' timeoutInterval:10.0];');
code.push(' timeoutInterval:' + parseInt(opts.timeout, 10).toFixed(1) + '];');
code.push('[request setHTTPMethod:@"' + this.source.method + '"];');

@@ -32,3 +38,3 @@

// Set request body
if (this.source.postData && this.source.postData.params || this.source.postData.text) {
if (this.source.postData && (this.source.postData.params || this.source.postData.text)) {
code.push(null);

@@ -35,0 +41,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc