Return application/xml from Serverless AWS Golang GET request HTTP endpoint


I have created a very simple HTTP Get endpoint in Serverless with Golang on AWS. Everything works fine, as long as I stay in JSON territory.

I would like to return xml now, especially the body. I found many issues, StackOverflows and documentation, but nothing works when I am testing it locally.

The most simple try I did was:

  handler: bin/request_get
  memorySize: 256
    - http:
        path: /request
        method: get
        integration: lambda
          template: $input.path('$.body')
            Content-Type: "'application/xml'"

I tried what is documented here and many other things or formats how to do it but nothing changes the result at all.

If I invoke it locally with e.g.

serverless invoke local -f api_request_get -p .\test_get.json

it always returns just a full Json response, not even only body for example, but everything as if the template is not picked, no matter if like this, with a specific status code etc.

Any hint or pointing in the right direction is highly appreciated because I am probably just missing this small thing ^^

Thanks a lot in advance