1

I try use service httpClient post but I have this error:

enter image description here

code service:

constructor(private http:HttpClient) { }

              Login(data)
              {

                let headers: any = new HttpHeaders();
                headers.append('Content-Type', 'application/json');

                return this.http.post('link api',data,{headers: headers})
                .subscribe(res => console.log(res),err => { console.log(err);});

              }

and I try add responseType: 'text' but also error ... I use angular 4

2
  • It might be a silly question, but are your sure your 'link api' is a well formed url ? Commented Apr 5, 2018 at 23:21
  • Yes link api is a well formed url ... Commented Apr 6, 2018 at 4:52

2 Answers 2

4

From what I can see, it's not an error from the http client directly, but from your server.

In a similar issue, the problem was coming from CORS and the fact that the Access-Control-Allow-Origin header was not correctly added in case the server response did not have a 20X or 30X status.

Did you check your server and log the call ?

Hope that helps

Sign up to request clarification or add additional context in comments.

1 Comment

Documentod-Max:1MB) Message: Http failure response for 3/api/enroll/evault/enr/upload.ocal: 0 Unknown Erroг Save
0

In the backend code, If you are using Spring boot add an annotation @Crossorigin right above the CRUD API call method.

1 Comment

How to faraway of this error in Janaadhaar Documentod-Max:1MB) Message: Http failure response for 3/api/enroll/evault/enr/upload.ocal: 0 Unknown Erroг Save

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.