1

I need your help to configure a mapping json file in WireMock. I have two problems to begin: 1- I need to see in the response the same headers that I sent by GET request. I only can show one header. How I should add a second headers in the body response to show it? 2- Does it possible add in the body some other values or text as well?

I have this json:

{    
"request": 
    {      
    "urlPath": "/templated"    
    },    
    "response": 
        {        
        "body": "{{request.headers.msisdn.[0]}}",        
        "transformers": ["response-template"]    
        }       
}

I run this:

curl -X GET \ -H "" \ -H "msisdn: 881163662742" \ -H "client: 1c30cd57-183c-491d-a666-056fed10060a" \ http://localhost:8000/templated

I get this: 881163662742

I want this as response:

For a second header in the body response, i tried this json without success:

{    
"request": 
    {      
    "urlPath": "/templated"    
    },    
    "response": 
        {        
        "body": "{{request.headers.msisdn.[0]},{request.headers.client.[0]}}",        
        "transformers": ["response-template"]    
        }       
}

If you know some website with examples about it, I'll appreciate.

Thanks!

Sebastian Diaz
  • 155
  • 7
  • 19

1 Answers1

2

You're missing some Handlebars braces. Try:

{{request.headers.msisdn.[0]}},{{request.headers.client.[0]}}

Tom
  • 3,471
  • 21
  • 14