Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
How to catch Laravel errors using capacitor http plugin

I have some validations in Laravel. When using axios I used .catch() to get those errors. Due to some cors issues, I started to use @capacitor-community/http library as an alternative to axios in order to handle http requests on mobile. But I have no idea how to catch validation errors and other errors coming from Laravel through this plugin. I have attached my code below,

This is the validation part of my Laravel code

$request->validate([
   'username' => 'required | string',
   'email'    => 'required | email | unique:users,email',
   'password' => 'required | string | confirmed | min:8',
]

This is my vue code,

<script setup>
...
import { Http } from "@capacitor-community/http";

const registerUser = async () => {
  loadingState.value = true;
  const options = {
    url: `${requestURL.value}/register_app_user`,
    headers: { "Content-Type": "application/json" },
    data: userForm,
  };

  const response = await Http.request({ ...options, method: "POST" });
};

</script>

I'm receiving HTML content without receiving any errors. Really appreciate it if somebody could help thanks.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

By including ,

headers: { Accept: "application/json", "Content-Type": "application/json" },

It worked

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda