Skip to content

Commit

Permalink
Fix pathname parser by using fake protocol and hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
HughePaul committed Dec 3, 2021
1 parent 3c1a71a commit 3508e0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const express = require('express');
const formatting = require('../formatting');
const validation = require('../validation');

const url = req => new URL(req.originalUrl, req.protocol + '://' + req.hostname);
const url = req => new URL(req.originalUrl, 'http://hostname');

class BaseController {
constructor(options) {
Expand Down
2 changes: 1 addition & 1 deletion test/controller/spec.index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Form Controller', () => {
};
req = request({
method: 'GET',
protocol: 'http:',
protocol: 'http',
originalUrl: '/base/route?this=is&a=query',
url: '/route',
baseUrl: '/base',
Expand Down

0 comments on commit 3508e0f

Please sign in to comment.