How to solve this error angular http

Response for preflight has invalid HTTP status code 401

I have started with super app from ionic and i have changed example url to my url

My code is

post(endpoint: string, body: any, reqOpts?: any) {
reqOpts = {
headers: new HttpHeaders().set(‘Authorization’,‘Basic V2FwcHlVSTp3QVBQWXVpQE5T’)
};
return this.http.post(this.url + ‘/’ + endpoint, body, reqOpts);
}

and my error is

but i am getting response in postman

Guys please help me out

Read this forum post, about facing the same problem (Unauthorized).

I have tried a lot of code changes with different different angular versions, unfortunately still i am not able to solve this issue…

My request is send as OPTIONS instead of POST when i will add Authorization in headers
if i remove all the headers then request is on POST

with this Http, Headers, RequestOptions its working in @angular/ 2.2.1
but i am not able to solve this in angular 4.4.6 and 5.0.5

did you notice the double slash before get categories

ya i have noticed that and corrected but issue is still same…

I have removed Authorization in my server and tested without headers in http.post, response is coming
but when i will add Authorization, that time request method will automatically changing from POST to OPTIONS

I have added android platform and build apk… i got the response in real device but i didn’t get response in browser with headers…