Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Error OK as response from http post

I am making an api call to node server. Its a post call but I am getting error as response but the data on firebase changes.

const header : HttpHeaders = new HttpHeaders()
header.append('Content-Type', 'application/x-www-form-urlencoded')

this.http.post('http://localhost:3000/s/getKey', { seqKey : 'invoices' }, {
  headers : header
}).subscribe(data => {
  console.log(data)
})

Update

Error Image

like image 967
RateM Avatar asked Oct 20 '25 01:10

RateM


1 Answers

I had the same problem. I was using the Spring REST API on the backend which was just returning a String, which was a problem because Angular HttpClient expects JSON. I solved it by wrapping my String in a simple POJO and returned that instead.

like image 181
vinays84 Avatar answered Oct 22 '25 04:10

vinays84