Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

328
Visualizações
ReactJS Axios Http Cannot read properties of undefined (reading 'protocol')

I am trying to make link this to the click of a button on my ReactJS site. When I click the button I receive the error "uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')"

async function call () {
        try {
            axios({
                method: 'post',
                url: url,
                header: {
                  "Content-Type": 'application/json',
                  "Authorization": `Bearer ${USER_KEY}`
                },
                data: {
                  prompt: script,
                  temperature: 0,
                  max_dist: 60,
                  stat_request: 1.0,
                  divider: ["\"\"\""]
                }
              }).then(
                res => {
                    console.log(res.json())
                }
              );
        } catch (error) {
            return {statusCode: 500, body: error.toString()}
        }
    }

I am trying to convert the following curl call

curl https://myurlpath.com/test/call \
   -H "Content-Type: application/json" \
   -H "Authorization: Bearer USERS_KEY" \
   -d '{
   "prompt": "Please enter your thoughts:\n\"\"\"\nSome Generic paragraph.\n\"\"\"\n",
   "temperature": 0,
   "max_dist": 60,
   "stat_request": 1.0,
   "divider": ["\"\"\""]
 }'
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda