Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
axios POST devuelve 200 pero la base de datos no se actualiza

Este es mi código, puede obtener la respuesta con 200 pero la base de datos no se actualiza. El backend dijo que había recibido un valor nulo.

 axios.post('api/nosql/LineController/insertLine', { line:{ id:this.id, directional:this.directional, kilometer:this.slide1.distance, runtime:runtime, interval:this.slide2.shift, type:this.type, }, stationList: this.newPlatforms, })

Y también probé este código, el problema permaneció.

 axios({ method:"post", changeOrigin:"true", url:"api/nosql/LineController/insertLine", transformRequest:[ function(data){ return QS.stringify(data); } ], data: { line:{ id:this.id, directional:this.directional, kilometer:this.slide1.distance, runtime:runtime, interval:this.slide2.shift, type:this.type, }, stationList: this.newPlatforms, } })

el código en el backend

 public Object insertLine(HttpServletRequest request) throws IOException { StringBuffer lineInfoAndStations = new StringBuffer(); String line; BufferedReader reader; reader = request.getReader(); while(null != (line = reader.readLine())) { lineInfoAndStations.append(line); } return service.addLine(lineInfoAndStations.toString()); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

si usa el tipo de contenido como aplicación/json, elimine el atributo transformRequest. si usa application/x-www-form-urlencoded, no puede publicar una matriz u objeto en el backend

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!