Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError [ERR_INVALID_CHAR] when using with axios@1.x #212

Closed
weeniearms opened this issue Oct 19, 2022 · 3 comments
Closed

TypeError [ERR_INVALID_CHAR] when using with axios@1.x #212

weeniearms opened this issue Oct 19, 2022 · 3 comments

Comments

@weeniearms
Copy link

When using with the lastest version of axios (1.x) I get the following error:

TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["0"]
    at ClientRequest.setHeader (node:_http_outgoing:647:3)
    at new ClientRequest (node:_http_client:284:14)
    at Object.request (node:http:97:10)
    at RedirectableRequest._performRequest (/tmp/axiosretry/node_modules/follow-redirects/index.js:284:24)
    at new RedirectableRequest (/tmp/axiosretry/node_modules/follow-redirects/index.js:66:8)
    at Object.request (/tmp/axiosretry/node_modules/follow-redirects/index.js:523:14)
    at dispatchHttpRequest (/tmp/axiosretry/node_modules/axios/dist/node/axios.cjs:2322:21)
    at new Promise (<anonymous>)
    at httpAdapter (/tmp/axiosretry/node_modules/axios/dist/node/axios.cjs:2058:10)
    at Axios.dispatchRequest (/tmp/axiosretry/node_modules/axios/dist/node/axios.cjs:3151:10) {
  code: 'ERR_INVALID_CHAR'
}

Steps to reproduce:

  1. Run the following server code:
const http = require('http')
const server = http.createServer((req, res) => {
  res.writeHead(500)
  res.end('err')
})
server.listen(8080)
  1. Execute the following client code:
const axios = require('axios')
const axiosRetry = require('axios-retry')

const client = axios.create()
axiosRetry(client, { retries: 3 })

client.get('http://localhost:8080').catch(err => console.error(err))
@kuizuo
Copy link

kuizuo commented Oct 21, 2022

I also have this situation.

My environment:

  • node: 16.15.1
  • axios 1.1.3
  • axios-retry 3.3.1

@paulsouche
Copy link

Duplicate of #213 There is an opened PR on axios axios/axios#5090

@mindhells
Copy link
Member

I believe based on @paulsouche comment we can close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants