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

153
Visualizações
problem with axios get error 400 bad request

I have been stuck for quite a while because when I launch a call to my API to retrieve data (therefore a GET method) I have a 400 bad request error off on postman I manage to retrieve the data in status 200. However in my axios I pass the parameters well as well as the useful headers.

Code axios status 400 :

async getAssociatedPlant() {                
                this.$axios.$get('lnk/plant/plants', {
                    headers: {
                        "Content-Type": "application/json",
                    },
                    params: {
                        link: "good",
                        plant_id: this.plantActive.id,
                    },
                    
                })
                    .then(response => {
                        console.log(response) 
                    }).catch(error => {
                        console.log(error)
                    });
            },

Image useful for understanding :

Postman Headers status 200 OK

Postman Params status 200 OK

Erreur 400 bad request

Request Payload

Request Response

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try adding data:{} to your request config.

async getAssociatedPlant() {
    this.$axios.$get('lnk/plant/plants', {
        headers: {
            "Content-Type": "application/json",
        },
        data:{},
        params: {
            link: "good",
            plant_id: this.plantActive.id,
        },

    })
        .then(response => {
            console.log(response)
        }).catch(error => {
            console.log(error)
        });
}
about 4 years ago · Juan Pablo Isaza Relatório
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