Reputation: 802
EDIT3: SOLUTION after hours:
Firefox extension uBlock blocked the request (probably because it contained adverts)
Lesson learned: always check in a private tab!
I Really run out of ideas and appreciate every bit of advice :)
EDIT:
For intuitivity:
Im sending two POST requests
/api/adverts/search which does not even show up in Firefox network tab.
and
/api/marketplacecategories/get which returns successfull with 200
EDIT2:
The same request from a fresh angular app works
Sending the request:
let options = {
'headers' : {
'accept': 'application/json'
}
}
let data = new FormData()
this.http.post("/api/adverts/search",data, options)
.subscribe(
data => {
console.log("success")
console.log(data)
}
);
Angular is not sending the request:
But instead giving me an error in the js console:
Meanwhile the other POST request to the same api is working just fine.
Postman to the same url works just fine:
CORS headers are set by server globally and work just fine for the other successfull request:
Does anyone have the slightest idea?
Im quite desperate :D
Upvotes: 1
Views: 2113
Reputation: 802
Firefox uBlock Origin extension blocked the request
probably because it contained adverts.
Lesson learned: always check in a private tab!
Solved.
Thank you all very much for your time and advice!
Upvotes: 1
Reputation: 22213
You need to add the full url like:
this.http.post("http://192.168.56.11:2503/api/adverts/search",data, options)
You should store the common port in environment.ts
apiUrl: "http://192.168.56.11:2503"
and then,
this.http.post(`${environment.apiUrl}/api/adverts/search`,data, options)
Upvotes: 0