Sha256: 99f62e15ea9297cb3269d01d6c21036f2d0915947896786cccce2eaca70f942b

Contents?: true

Size: 537 Bytes

Versions: 17

Compression:

Stored size: 537 Bytes

Contents

/**
 * Strip host middleware is responsible for stripping hostname from request path
 * This to handle requests that uses (normally over proxies) an absolutURI as request path
 */

var createStripHostMiddleware =  function() {
  return function(request, response, next) {
    function stripHostFromUrl(url) {
      return url.replace(/^http[s]?:\/\/([a-z\-\.\:\d]+)\//, '/');
    }

    request.normalizedUrl = stripHostFromUrl(request.url) || request.url;
    next();
  };
};

// PUBLIC API
exports.create = createStripHostMiddleware;

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.4.1 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.4.0 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.3.0 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.2.1 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.2.0 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.1.0 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.0.8 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.0.7 jasmine/node_modules/karma/lib/middleware/strip_host.js
hooch-0.0.6 jasmine/node_modules/karma/lib/middleware/strip_host.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/lib/middleware/strip_host.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/lib/middleware/strip_host.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/lib/middleware/strip_host.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/lib/middleware/strip_host.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/lib/middleware/strip_host.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/lib/middleware/strip_host.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/lib/middleware/strip_host.js