samedi 11 août 2018

AngularJs Post request Behavior over Powershell Web Request Behavior

Does angular $http.post require customization to work as Invoke-WebRequest ?

After testing a web server, with Invoke-WebRequest

Powershell request response

When I used the following script with Angularjs

postData(credentials){

    return new Promise((resolve, reject) =>{
      let headers = new Headers();
        this.http.post(loginUrl, JSON.stringify(credentials) , {headers: headers}). 
      subscribe(res =>{

        resolve(res.json());

      }, (err) =>{
        reject(err);
      });

    });

I called the method as

this.authService.postData(this.userData, "Login").then((result) =>{

The server responded with

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
login.ts:50 error Response with status: 500 Internal Server Error for URL:  
 http://../

Here is the snapshot of angular request.




Aucun commentaire:

Enregistrer un commentaire