intoli / user-agents

A JavaScript library for generating random user agents with data that's updated daily.
Other
983 stars 51 forks source link

Invalid header in package #53

Open CoffeeFlux opened 1 year ago

CoffeeFlux commented 1 year ago

In recent versions of the package, a header containing emoji is included (posted below). This results in errors with lots of clients, including node-fetch and chromium fetch, with an error like this:

VM245:2 Uncaught TypeError: Failed to execute 'fetch' on 'Window': Failed to read the 'headers' property from 'RequestInit': String contains non ISO-8859-1 code point.
    at <anonymous>:1:17

Can you avoid including user-agents outside of the ascii range?

Header:

  {
    "appName": "Forget about App Name.",
    "connection": {
      "downlink": 10,
      "effectiveType": "4g",
      "rtt": 50
    },
    "platform": "This is CODM platform",
    "pluginsLength": 0,
    "vendor": "Oja Vendor Agba. 😎",
    "userAgent": "SUPERSTAR! the guy dey form superstar  Chee..... 😹",
    "viewportHeight": 660,
    "viewportWidth": 1350,
    "deviceCategory": "desktop",
    "screenHeight": 768,
    "screenWidth": 1366,
    "weight": 0.00006628526257710449
  },
CoffeeFlux commented 1 year ago

Hi @sangaline - any chance you can take a look at this? It's causing a lot of issues in prod for me, and I'm sure other people. I can work around it if needed, but would love to see this fixed for everyone :)