New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

combo-url-parser

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combo-url-parser - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

22

lib/middleware.js
var parser = require('./parser.js');
var request = require('request');
var CombinedStream = require('combined-stream');
var mime = require('mime');
/**
* Middleware for connect
* @param {Object} options
* @param {Number} options.port
* @returns {Function}
*/
module.exports = function (options) {
options = options || {};
if (!options.port) {
throw new Error('combo-url-parser: port is missing!');
}
var port = options.port;
port = port ? ':' + port : '';
module.exports = function () {
return function (req, res, next) {
var urls = parser(req.url);

@@ -28,5 +19,12 @@

// http://stackoverflow.com/questions/7109732/express-setting-content-type-based-on-path-file
var type = mime.lookup(urls[0]);
if (!res.getHeader('content-type')) {
res.setHeader('Content-Type', type + '; charset=UTF-8');
}
var combinedStream = CombinedStream.create();
urls.forEach(function (path) {
combinedStream.append(request('http://127.0.0.1' + port + '/' + path));
combinedStream.append(request('http://' + req.headers.host + path));
combinedStream.append('\n');

@@ -33,0 +31,0 @@ });

@@ -5,3 +5,3 @@ {

"description": "A util to parser comboed url",
"version": "0.1.1",
"version": "0.1.2",
"repository": {

@@ -19,3 +19,4 @@ "type": "git",

"combined-stream": "0.0.4",
"request": "~2.34.0"
"request": "~2.34.0",
"mime": "~1.2.11"
},

@@ -22,0 +23,0 @@ "devDependencies": {

@@ -27,2 +27,5 @@ [![build status](https://secure.travis-ci.org/maxbbn/combo-url-parser.png)](http://travis-ci.org/maxbbn/combo-url-parser)

### 0.1.2
- 添加 content-type Header
### 0.1.1

@@ -29,0 +32,0 @@

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