"output-encoding" configuration

26 views
Skip to first unread message

Tecla Quanili

unread,
Aug 4, 2025, 3:20:55 PMAug 4
to comm...@krakend.io
Hello,

I have a question regarding a Krakend setup:
the backend api returns as output an xml ("encoding" : "xml") and the client (Postman) correctly displays the response reporting as Response header: Content-Type equal to 'application/xml;charset=iso-8859-1'.

By invoking the endpoint however you configure "output_encoding" ("xml", "no-op", "negotiate"), Postman always receives from Krakend a Content-Type equal to 'application/json;charset=UTF-8', displaying the content as JSON.

Is the response in XML format only usable on the Enterprise version?

THKS

Here's the configuration:



"endpoint": "/api/globy/jms/MyAPIResponse",
  "method": "GET",
  "extra_config": {
    "auth/validator": {
      "alg": "RS256",
      "roles_key_is_nested": true,
      "roles_key": "realm_access.roles",
      "roles": [
        "globy-jms-api"
      ],
      "disable_jwk_security": true,
      "operation_debug": true,
      "output_encoding": "xml"
    }
  },
  "backend": [
    {
      "host": [
        "{{ $host }}"
      ],
      "method": "GET",
      "encoding" : "xml",
      "url_pattern": "/api/message/{JWT.realm-id}/{JWT.organization}/MyAPIOut?type=queue&clientId=KRAKENID&
readTimeout=1000&oneShot=true&xml=true",
      "extra_config": {
        "backend/http": {
          "return_error_code": true
        }
      }
    }
  ]
},   




Tecla Quanili

unread,
Aug 13, 2025, 11:41:12 AMAug 13
to KrakenD Community, Tecla Quanili
--- additionally, it is always passed as a header in the request:   "Accept: application/xml, text/xml"

Daniel Ortiz

unread,
Aug 13, 2025, 11:48:28 AMAug 13
to Tecla Quanili, KrakenD Community
Hi,

Notice that you are setting "output_encoding" inside the "auth/validator" config, instead of at the endpoint level.
I think you should add the schema validation in your IDE to make this issue easier and faster.
https://www.krakend.io/docs/developer/ide-integration/
You can also use the krakend check command to validate the config.

Best regards,
Daniel Ortiz Daniel Ortiz
CIO
KrakenD Logo
LinkedIn icon  Twitter icon
Confidentiality Notice: This email, including any attachments, may contain confidential and privileged information for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please contact the sender immediately and destroy all copies of this email. Thank you. This email has been sent in accordance with the European Union General Data Protection Regulation (EU GDPR).


--
You received this message because you are subscribed to the Google Groups "KrakenD Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to community+...@krakend.io.
To view this discussion visit https://groups.google.com/a/krakend.io/d/msgid/community/c17b76e8-d277-4779-acba-ed260e1ae13bn%40krakend.io.
Reply all
Reply to author
Forward
0 new messages