2

Problem:

  • When I send a yaml file I have crafted from looking at my postman request. I get the eror "ValueError: expected ':' after conversion specifier" along with a lot of other errors. This seems to be caused by the addition of "x-api-key" in the headers as when I take this away the error disappears.
---
test_name: Log in

stages:
 - name: Send log in request

    request:
      url: https://myurl.com/auth
      method: POST
      headers:
        Content-Type: application/json
        x-api-key: "<DQDg4lEmau^9{>!Os'mhNP" #Edited this to keep safe but kept the exact same layout
        Authorization: Basic bm90bXlyZWFsZW1haWxAZ21haWwuY29tOnBhc3N3b3JkMTIzCg==

    response:
      status_code: 200
...

Expected Results:

  • Able to authorise with the server and get JWT Token as I do on Postman.

Actual Result:

  • The script fails with many errors. The main one appears to be the one I listed above however I can provide more if I am wrong about that.

Additional Info:

  • Removing "x-api-key" lets the request go through however "Forbidden" is returned as this is a required value, I believe.

Thanks for any help, I have been looking through the documentation on Tavern for an hour or two and browsing the internet for the answer. I am new so I am sure it is something simple, but any advice would be great.

Thanks!

RemakingEden
  • 257
  • 3
  • 11

1 Answers1

3

This was due to a curly bracket in the quoted "x-api-key".

Curly Brackets must be escaped by writing two in place of one.

e.g.

x-api-key: "<DQDg4lEmau^9{{>!Os'mhNP"
RemakingEden
  • 257
  • 3
  • 11