1

I'm tring to make a poc of karate, I tried put method and it works correctly, but I have an error when tring the post method.

The error that I have is :

13:40:44.929 [main] ERROR com.intuit.karate - 
org.apache.http.client.CircularRedirectException: Circular redirect to 'http://l3vpn-api-x- 
dev-achraf.afn-prv.opc-blue.tb.rns.equant.com/l3vpn/ppp-access/dry-run/', http call failed 
after 731 milliseconds for url: https://l3vpn-api-x-dev-achraf.afn-prv.opc- 
blue.tb.rns.equant.com/l3vpn/ppp-access/dry-run
13:40:44.945 [main] ERROR com.intuit.karate - 
src/test/java/bvpn/happypath/happypath.feature:11
When method post
http call failed after 731 milliseconds for url: https://l3vpn-api-x-dev-achraf.afn-prv.opc- 
blue.tb.rns.equant.com/l3vpn/ppp-access/dry-run
org.apache.http.client.CircularRedirectException: Circular redirect to 'http://l3vpn-api-x- 
dev-achraf.afn-prv.opc-blue.tb.rns.equant.com/l3vpn/ppp-access/dry-run/'
src/test/java/bvpn/happypath/happypath.feature:11

http call failed after 731 milliseconds for url: https://l3vpn-api-x-dev-achraf.afn-prv.opc- 
blue.tb.rns.equant.com/l3vpn/ppp-access/dry-run
org.apache.http.client.CircularRedirectException: Circular redirect to 'http://l3vpn-api-x- 
dev-achraf.afn-prv.opc-blue.tb.rns.equant.com/l3vpn/ppp-access/dry-run/'
src/test/java/bvpn/happypath/happypath.feature:11
---------------------------------------------------------
feature: src/test/java/bvpn/happypath/happypath.feature
scenarios:  1 | passed:  0 | failed:  1 | time: 0,7723
---------------------------------------------------------

This is my karate test :

      Feature: Happy path

      Background:
        Given url bvpn.url
        * def body = read("classpath:bvpn/data/toto-payload.json")

      Scenario: Test dry run post BVPN
        Given path bvpn.path.post.dryRun
        And request body
        And headers headersJson
        When method post
        Then status 200
        And print response

I'm confusing and don't know why I have this error.

Thanks for your help.

WinDoctor
  • 33
  • 5
  • sorry I took a quick look and I pass. on stack-overflow, you are expected to provide a MINIMAL example: https://stackoverflow.com/help/how-to-ask - if you are still stuck follow this process: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Jul 20 '23 at 13:55
  • I changed the answer to make it more understandable. – WinDoctor Jul 20 '23 at 14:59

2 Answers2

0

This is a long shot, but try * configure followRedirects = false and see if that makes any difference. See comments here: Karate API request with csrftoken sent twice

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • @WinDoctor this is now a case where we need to replicate it. no one has ever reported this, so who knows it may be an actual bug in your server. please follow this process else there is nothing anyone can do to help: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Jul 20 '23 at 15:20
  • I tried your response and now I have a response with status code 307, but I receive no response. – WinDoctor Jul 20 '23 at 15:20
  • @WinDoctor please see my comment above – Peter Thomas Jul 20 '23 at 15:22
  • I tried your solution but it doesn't work. I think this is related to the exception : "org.apache.http.client.CircularRedirectException: Circular redirect to". I searched for this exception and they indicates some solutions like https://github.com/android-async-http/android-async-http/issues/145#issuecomment-22613361. I tried to implement this solution but still now I haven't been able to. – WinDoctor Jul 21 '23 at 10:04
  • Also @Peter Thomas I desactive ssl validation with * configure ssl = true, can this bug be related to this ? Because in log we see that is tring to communicate to https url than go to http url : http call failed after 731 milliseconds for url: https://l3vpn-api-x-dev-achraf.afn-prv.opc- blue.tb.rns.equant.com/l3vpn/ppp-access/dry-run org.apache.http.client.CircularRedirectException: Circular redirect to 'http://l3vpn-api-x- dev-achraf.afn-prv.opc-blue.tb.rns.equant.com/l3vpn/ppp-access/dry-run/' – WinDoctor Jul 21 '23 at 10:08
  • @WinDoctor I honestly don't know. give me a way to replicate this and I will have an answer in 5 minutes. otherwise we can keep speculating here for weeks :) – Peter Thomas Jul 21 '23 at 11:19
  • Honestly I don't know how to give I way to replicate it, but I will try. Also I added my root ca to the jdk keystore and deleted configure ssl = true and the prolem is still present. – WinDoctor Jul 21 '23 at 11:46
  • @WinDoctor for the time being, see if you can manage by using cURL as a workaround for this case: https://stackoverflow.com/a/64352676/143475 - but if it is critical to you, I would suggest you get the help of a java developer who can debug the code and confirm that maybe karate needs better support for this particular "circular" case. the thing is this has never come up in the last 6 years – Peter Thomas Jul 21 '23 at 12:03
0

I resorved this problem by fixing Fastapi python server endpoint path. The endpoint that we have was like :

            @router.post("/", status_code=202)
            def post_access(
                body: PPPAccess,
            ):
                return apitest().start_workflow(
                    {"request": body.dict(), "http_verb": "post"},
                    CAMUNDA_L3_PPP_BVPN_WORKFLOW,
                )

I changed to :

                @router.post("/change_path/", status_code=202)
            def post_access(
                body: PPPAccess,
            ):
                return apitest().start_workflow(
                    {"request": body.dict(), "http_verb": "post"},
                    CAMUNDA_L3_PPP_BVPN_WORKFLOW,
                )

I hope that this response will help someone else.

WinDoctor
  • 33
  • 5