Avinash
Avinash

Reputation: 333

Angular 2 POST Request

While doing the POST request in Angular 2, I am getting:

"EXCEPTION: Response with status: 404 Not Found for URL:" .

However, while accessing the URL directly, I am getting the response page.

Also in my backend code, I can see my data getting passed from client side to server side:

Response_body: "{"Message":"Not able to add Language = A"}" headers: Headersok: false status: 404 statusText: "Not Found" type: 2 url: "http://localhost:1109/api/Language/AddLanguage"

onSubmit(val){
   console.log(val);
   this.languageService.testPost(val)
        .subscribe(
         (res:response) => console.log(res);
        );
}                

testPost(newVal) : Observable<any>{
    let body = JSON.stringify(newVal);
    console.log(body);
    let headers = new Headers({'Content-Type' : 'application/json'});
    let options = new RequestOptions({headers : headers});
    return this.http.post(this.logUrl,body,options)
        .map((res : Response) =>  res.json());
}

Upvotes: 2

Views: 286

Answers (1)

Rachit Pandey
Rachit Pandey

Reputation: 356

Yes Rachit,I think you are correct.While Debugging,In my Server side Code I found an Exception mentioning Too many Arguments while saving Data To Database.

There's the culprit I believe, this error generally occurs if you supply more than required params to an SP. So in your DB implementation if you are using SP(s) kindly check them one by one which one is supplying extra parameters. And if nothing else is the problem you should have this issue resolved.

Upvotes: 1

Related Questions