Can't send Bearer token in Karate

Viewed 974

I have to use token in API test to delete some quote. I can adjust it in Postman, but unfortunately, can't do it with the help of Karate. I get this error -> "...failed: connect timed out" and fail on method Delete.

Here the example:

Feature: API Test

  Background:
    * def token = 'someToken'
    
  Scenario: Quote Deleting
    * url 'URL?reference=AAA'
    * header Authorization = 'Bearer ' + token
    And method delete
1 Answers

You can try this sample, which works perfectly for me:

* def token = 'foo'
* url 'https://httpbin.org/anything'
* header Authorization = 'Bearer ' + token
* request { foo: 'bar' }
* method delete
Related