2

I want to send empty object in http get request body to work api on angular 10. Our api server need empty request body object in GET request.

I want like this { method: 'get', url: 'http://domain.api.com/api/method?param1=value1', body: { key:value }
}

Note: I dont want to use POST method for send request body.

  • An "empty body" would be `{}`. Why are you trying to send `{ key:value }`? – Marc Nov 03 '20 at 15:57
  • 1
    You should read the answers here about sending a `body` with a `GET` request: https://stackoverflow.com/a/983458/1024832 – Marc Nov 03 '20 at 15:59
  • Yes empty body {} , { key:value } it was example. – Sukhdev Patidar Nov 03 '20 at 16:28
  • You should read the answers here about sending a body with a GET request: stackoverflow.com/a/983458/1024832 >> i read this and i didnt understood , how can i implement it on angular 10 can you provide me sample code? – Sukhdev Patidar Nov 03 '20 at 16:34

1 Answers1

0

You should use Post for a payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.

You can read more detail here

Roath So
  • 121
  • 6