cheeaun / cheeaun/puppetron

lost port numbers

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
554
Forks
93
PR merge metrics
No merged PRs in 30d

Description

When not running on port 80 we encountered a problem where the port number (ex: 8080) was getting dropped and therefore suggest some thing like:

```const {origin, hostname, pathname, searchParams, port} = new URL(url);
const path = decodeURIComponent(pathname);

await new Promise((resolve, reject) => {
const req = http.request({
method: 'HEAD',
port: port,
host: hostname,
path,
}, ({statusCode, headers}) => {```
instead of
```
const {origin, hostname, pathname, searchParams} = new URL(url);
const path = decodeURIComponent(pathname);

await new Promise((resolve, reject) => {
const req = http.request({
method: 'HEAD',
host: hostname,
path,
}, ({statusCode, headers}) => {
if (!headers || (statusCode == 200 && !/text\/html/i.test(headers['content-type']))) {
reject(new Error('Not a HTML page'));```
ironically, I don't have easy access to port 80 so haven't tested this much yet, but thought I would raise the issue.

cheers,
Mark

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.