Uploaded image for project: 'REST Client'
  1. REST Client
  2. MGNLRESTCL-215

Rest client is sending empty body even when no body is defined in rest client definition

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • 2.0.4
    • None
    • None

    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

       

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                rfalvo Raphael Falvo
                DeveloperX
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:

                  Checklists

                    Bug DoR
                    Task DoD