2

I am describing the problem using pseudo karate code. I am trying to validate HTTP 401 status code from my api for incorrect bearer tokens. This is working fine in Postman, I am getting HTTP 401 with the same headers(which are used in karate). But in Karate I am not getting HTTP 401. I am getting an error with description: org/apache/commons/codec/binary/Base64. Note: this problem is only happening for HTTP 401. For other cases such as HTTP 200, karate works as expected.

Background:
* url 'https://<any endpoint that accepts bearer token>'

Scenario: Some Scenario
Given path "some path"
* headers { Authorization: 'Bearer <wrong token>' }
  When method GET

Response Received:

org/apache/commons/codec/binary/Base64

Response Expected: HTTP 401

Karate log:

1 > GET https://<request URL>
1 > Authorization: Bearer YXtyYmFrZGFzZGFrazM0MzQ=
1 > Host: comercial-pre.central.inditex.grp
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.7)
1 > Accept-Encoding: gzip,deflate
        

09:22:36.348 [main] ERROR com.intuit.karate - some.feature:13
When method GET
org/apache/commons/codec/binary/Base64
some.feature:13
 
Rajesh Dutta
  • 229
  • 1
  • 5

0 Answers0