Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49246

HttpClient with Headers

$
0
0

@StoRmtec wrote:

I have a Question for angular 5. I become an API Call to make this over angular but I become always a bad request from the API IIS Server.
This is the String
`With the Methode POST

On the http-Header: Accept: text/javascript

Content-Type: application/json

I’m Body: {encodedetUrl}

and this is my Code i take

getPosition(sql: string): Observable<Position[]> {

    let headers = new HttpHeaders().set('Content-Type', 'application/json');
headers = headers.set('Accept', 'text/javascript');

    let sqlstring = encodeURIComponent(sql);

    let string = '{"Befehl": "' + sqlstring + '","Datenbank": "DBScharnsteinTest", "Login": "username", "Passwort": "password", "PKMitarbeiterID": "2640"}';
    console.log();
    return this.httpClient.post<Position[]> (this.url, string, {headers});

  }

Can anybody Help me why that not work.

Thx

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49246

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>