jeramyRR
Is it proper to include data in the body of a GET?
I’m working on a controller for a service that will analyze a large amount of data sent by a client and return a response with more data.
Example Json that will be sent via client to the webpage:
{
Files: [
{
"Path": "\\path\\to\\file",
"Hash": "C9AC6AC028B52F851C3CA9BCA3930E8B782A2B38D1907E82955A6C4EF2D19D5A"
}
... # 100,000 more entries like this.
]
}
And the response will be something similar.
What is the proper Http Method to use in this case? Is it a GET with a json body, or is it a POST?
Most Liked
kip
cmkarlsson
My knowledge may be a bit old but back in the day it was generally bad practice to include a body with a GET request. Although not specifically prohibited in the spec there were a number of software entities that wouldn’t expect it and didn’t work properly or simply rejected the request. Think http proxy servers, caching layers etc. Back then it was safer to use POST whenever you had a body, a practice I still follow.







