Search code examples
angularrequesthttpclient

How to use HttpClient to send content into req.body of GET request in angular?


how to send data to req.body while requesting through a HttpClient.get()


Solution

  • As far as I can tell you cannot use HttpClient get to send a body. The only way is to use query.

    const someObject = {example object};
    http.get(url + '/?data='+ encodeURIComponent( JSON.stringify(someObject)));