1

I am trying to perform patch operation using latest version of Karate with below,

Also I notice the special charater "/" in the payload is replaced by "/" in the report. Hoping that is not a issue as I tried sending the exact payload captured in report through postman and the request went through. Is there a way to avoid replacing that special characters, even after using charset UTF-8 and surefire plugin configuration?

Scenario: Test for PATCH METHOD Given url URL And request [{ "op":"replace","path":"/Package/Content/Application/OtherIncome/0/@Frequency","value":"Monthly"}] And header Content-Type = 'application/json-patch+json; charset=utf-8' And header Accept = 'application/json' When method patch Then status 200

Error: 00:19:07.042 java.lang.RuntimeException: java.io.EOFException, http call failed after 2575 milliseconds for url: https://apigateway.bbldtl.int/babl/int/dev/loan-application-api/v1/applications/22634247

00:19:07.042 classpath:loanApplicationApi/Patch/editIncome/editIncome.feature:15

When method patch

http call failed after 2575 milliseconds for url: https://apigateway.bbldtl.int/babl/int/dev/loan-application-api/v1/applications/22634247

classpath:loanApplicationApi/Patch/editIncome/editIncome.feature:15

Shreyas
  • 67
  • 4
  • refer https://stackoverflow.com/a/68411097/143475 - so in my opinion this is a bug in your server if it cannot handle the request and karate has done the right thing. you are welcome to contribute code to karate to "fix" it, but you have to prove it first – Peter Thomas Jul 22 '22 at 15:22
  • @PeterThomas Thanks for checking this. I further looked in the server logs triggered for both POSTMAN and KARATE, and it appears server is behaving correctly sending the proper response for both requests triggered fromdifferent clients. While I would be interested in contributing fixing this, need some directions. – Shreyas Jul 25 '22 at 00:10
  • at the very least provide a way to replicate, else nothing can be done: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Jul 25 '22 at 04:17
  • @PeterThomas I am struggling to find a way on how we can replicate this issue without hitting our services. But one observation here is the request header content-type for this endpoint is different to other endpoints we have been using. Here is the Content-Type = 'application/json-patch+json. Not very sure if this is what is causing the issue. I shall also submit a issue . – Shreyas Jul 26 '22 at 07:33
  • if you read the link above there is guidance on how to replicate. if you can't replicate this and prove there is an issue on the karate side, your issue will be rejected – Peter Thomas Jul 26 '22 at 08:03
  • Hi @PeterThomas - Tried replicating this issue using karate mocks and it is working fine. However when we connect to our server, it results as http failure. Sharing few more observations below, have you come across any such behaviour? We are in a situation we need this endpoint across most of our e2e scenario now, happy to explore more if you want me to try anything here. Adding few more details in my next comment regarding this which I think can help diagnose further – Shreyas Jul 29 '22 at 03:58
  • Background about our service: Our microservice exposes 2 PATCH endpoint to update different sections of a json payload. PATCH1 – Results with a response body and content-type is application/json PATCH2 – NO response body, only for status code 200. But gives a response body for other status and content-type is application/json-patch+json – Shreyas Jul 29 '22 at 03:59
  • Problem statement – We are able to successfully test every status of both endpoint successfully, except for the PATCH endpoint that results with no response body for status 200. When that status is 200 without any response body, it is results in http failed – Shreyas Jul 29 '22 at 04:03
  • I have nothing to add to my comments above. if you can get a `cURL` command that works, add that to your question (you can edit) and maybe someone else will have ideas – Peter Thomas Jul 29 '22 at 04:12
  • 1
    @PeterThomas We actually changed our API build to send response with status code 204 with a response body and migrated gateway from APIC to kong and notice our scripts are working. It was anyway not related to Karate, but strange behaviour on our build though. – Shreyas Aug 11 '22 at 07:12

0 Answers0