[MGNLRESTCL-215] Rest client is sending empty body even when no body is defined in rest client definition Created: 27/Jun/23  Updated: 28/Jun/23

Status: Accepted
Project: REST Client
Component/s: None
Affects Version/s: 2.0.4
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Raphael Falvo Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLRESTCL-148 RestEasy not allow to do GET request ... Open
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Epic Link: RESTClient 2024
Team: DeveloperX

 Description   

Magnolia is sending body in request even when no body property is defined in rest client definition.

Some APIs are not behaving properly when sending a GET with an empty body, especially when content type header is set to application/json.

 

We are facing this issue with BSI calls, please see below some samples :

 
This is the regular GET without body, it works fine
 

curl --location --request GET 'https://partner.bsi-software.com/trial/studio215/inbound/default/e/l/insurance-demo-user-old?customerNo=343&firstName=Bartosz&lastName=Staryga&email=bartoszstaryga%40gmail.com&notes=Travel%2C%2CHousing' \
--header 'Content-Type: text/plain'

Then a GET with empty body, with header Content-Type set to text/plain, it still works
 

curl --location --request GET 'https://partner.bsi-software.com/trial/studio215/inbound/default/e/l/insurance-demo-user-old?customerNo=343&firstName=Bartosz&lastName=Staryga&email=bartoszstaryga%40gmail.com&notes=Travel%2C%2CHousing' \
--header 'Content-Type: text/plain' \
--data ''

 

And now GET with empty body, with header Content-Type set to application/json, doesn’t work. This is basically how magnolia rest client is sending the request.
 

curl --location --request GET 'https://partner.bsi-software.com/trial/studio215/inbound/default/e/l/insurance-demo-user-old?customerNo=343&firstName=Bartosz&lastName=Staryga&email=bartoszstaryga%40gmail.com&notes=Travel%2C%2CHousing' \
--header 'Content-Type: application/json' \
--data ''

 
 

Please find the following PR as a candidate to fix this issue, by not sending body when no body property is declared in the rest client definition:

https://git.magnolia-cms.com/projects/MODULES/repos/rest-client/pull-requests/155/overview

 


Generated at Mon Feb 12 10:44:16 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.