Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send a body with DELETE method #42

Closed
satishautade opened this issue Apr 20, 2017 · 5 comments
Closed

Unable to send a body with DELETE method #42

satishautade opened this issue Apr 20, 2017 · 5 comments
Assignees

Comments

@satishautade
Copy link
Contributor

satishautade commented Apr 20, 2017

Hi Peter,
I have recently started using Karate and I am loving it so far.
Because, I have extensive experience in using Cucumber before and I feel right at home with Karate.
Kudos !!!
Although, I realised that the karate ignores the body passed with a DELETE request.
I know this is a standard practise jn the RESTful services world and it is a recommended approach.
But, the API that I am testing has made a conscious decision to not follow it based on our circumstances.
In our case we have 'relationship' resource which does not have an ID because it doesn't have a existence on it's own.
Hence in our case, we make a DELETE request to this resource with a BODY. Please find below a sample request:

Scenario: Validate body is passed with a DELETE request
Given path 'document1', 'relationships'
And request
"""
<Relationships> <Relationship TypeID="VALID" TargetDocumentId="document1"/> </Relationships>
"""
When method DELETE
Then status 200

What is your opinion about making the request BODY optional for DELETE method. Meaning pass the ENTITY for a DELETE request if it is present or else just make the request without it.
Currently, I am using patched version of Karate and Jersey Client which allows me to do this. If you are inclined towards doing it, I would be happy to share my patch.

@ptrthomas
Copy link
Member

yes, I don't see a problem with this, do submit a patch ! thanks for helping out with the other questions as well, really appreciate it.

@satishautade
Copy link
Contributor Author

satishautade commented Apr 24, 2017

Hi Peter,
Please find attached patch files that I am using. Github was not allowing me to upload .PATCH files so I used .TXT extension.

  1. The change in Karate
    accept_body_for_delete_karate.patch.txt

  2. The other change is in Jersey Client as I mentioned earlier.
    make_body_in_delete_optional_jersey.patch.txt
    I don't know if it is possible to do something in Karate to get it working without having to patch Jersey Client.
    But If we have to get this other patch in Jersey Client then I will be happy to follow it up with them. Kindly let me know.

Thanks a bunch.

@ptrthomas
Copy link
Member

A couple of things, you can consider submitting a pull request, which means that your name will show up in the contributors list. Second: from v0.3.0 onwards - Karate supports the Apache Http Client, I'm wondering if you tried that and perhaps it supports the DELETE you want better than Jersey.

I'm assuming there's no hurry on this ticket as you have a workaround that works for you and because this is a unique use-case. I may take some time to look at this in detail.

@satishautade
Copy link
Contributor Author

Hi Peter,
I have submitted the pull request for this change on v0.3.1.
Kindly review it when you find some time.

Thanks,
Satish Autade

@ptrthomas
Copy link
Member

conversation moved to pull request #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants