Getting multiple response while calling python API from Angular

Viewed 39

While calling the python API from angular 10. I am getting multiple response. How to overcome it.

Python API Response from Angular Service call:

1. Object { type: 0 } # how to avoid this additional response
2. Object { headers: {…}, status: 201, statusText: "Created", url: "https://*********/1bcd2a20-dd60-4cfe-984f-7f3607f01e7c", ok: true, type: 4, body: "{\"status\":{}}" }

Angular Service Call:

postCall(identifier): Observable<HttpEvent<{}>> {
        let token1 = localStorage.getItem('token');

        const headerSettings: { [name: string]: string | string[]; } = {};
        headerSettings['Authorization'] = 'Bearer ' + token1;
           
        const req = new HttpRequest('GET', 'https://***********/'+identifier, null, {
            reportProgress: false,
            responseType: 'text'
        });
        
        const newHeader = new HttpHeaders(headerSettings);
        let changedRequest = req.clone({
            headers: newHeader
        });

        return this.http.request(changedRequest);
    }
0 Answers
Related