Skip to content

Unhandled Error : Process crashed with: TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Host"]  #1804

@adityathebe

Description

@adityathebe
const axios = require('axios')

;(async () => {
  const url = "http://www.smun.spb.ru"
  const head_response = await axios.head(url)

  console.log(head_response.headers)
})()
.then(() => { console.log("Success")})
.catch(() => { console.log("Error")})

Throws this exception

Process crashed with: TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["Host"]
    at validateHeader (_http_outgoing.js:506:11)
    at ClientRequest.setHeader (_http_outgoing.js:510:3)
    at new ClientRequest (_http_client.js:228:12)
    at Object.request (http.js:41:10)
    at RedirectableRequest._performRequest (/home/runner/node_modules/follow-redirects/index.js:158:24)
    at RedirectableRequest._processResponse (/home/runner/node_modules/follow-redirects/index.js:249:10)
    at ClientRequest.RedirectableRequest._onNativeResponse (/home/runner/node_modules/follow-redirects/index.js:39:10)
    at Object.onceWrapper (events.js:272:13)
    at ClientRequest.emit (events.js:180:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:540:21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions