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

Admin Delete with mappings in body #409

Merged
merged 8 commits into from
Jan 31, 2020
Merged

Conversation

NoahLerner
Copy link
Member

Using HTTP Delete verb, a user can send multiple mapping jsons (with GUIDs) for deletion.
Note: AllowBodyForAllHttpMethods must be set to true.

@NoahLerner
Copy link
Member Author

Hi again @StefH

I've extended functionality of the HTTP Delete verb at the __admin/mappings endpoint by allowing the user to send a json body with his mappings for deletion. The mappings must include Guids. Each Guid which is mapped to a valid mapping on the server is deleted and confirmed in the response.

If the mappings json is malformed, the user receives a BadRequest response.

Note that the AllowBodyForAllHttpMethods must be set to true.

src/WireMock.Net/Server/WireMockServer.Admin.cs Outdated Show resolved Hide resolved
src/WireMock.Net/Server/WireMockServer.Admin.cs Outdated Show resolved Hide resolved
src/WireMock.Net/Server/WireMockServer.Admin.cs Outdated Show resolved Hide resolved
@NoahLerner NoahLerner requested a review from StefH January 30, 2020 15:27
src/WireMock.Net/Server/WireMockServer.Admin.cs Outdated Show resolved Hide resolved
src/WireMock.Net/Server/WireMockServer.Admin.cs Outdated Show resolved Hide resolved
src/WireMock.Net/Server/WireMockServer.Admin.cs Outdated Show resolved Hide resolved
@StefH StefH added the feature label Jan 30, 2020
Copy link
Collaborator

@StefH StefH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

@NoahLerner NoahLerner requested a review from StefH January 30, 2020 19:56
Copy link
Collaborator

@StefH StefH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small thing

src/WireMock.Net/Server/WireMockServer.Admin.cs Outdated Show resolved Hide resolved
@NoahLerner NoahLerner requested a review from StefH January 31, 2020 13:09
Copy link
Collaborator

@StefH StefH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@StefH StefH merged commit 07ac650 into WireMock-Net:master Jan 31, 2020
@NoahLerner
Copy link
Member Author

@StefH - How can I update the Wiki to reflect the changes?

@StefH
Copy link
Collaborator

StefH commented Feb 2, 2020

I did send an invite to this project, you should be able to edit the wiki I think.

@StefH
Copy link
Collaborator

StefH commented Feb 2, 2020

I just remembered..

This file https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net.RestClient/IWireMockAdminApi.cs
needs also an update to support this new method.

Can you make a PR for this ?

@NoahLerner
Copy link
Member Author

I think I just made a mess of the repo while trying to fix this. I don't want to mess it up anymore, can you take a look?

@NoahLerner
Copy link
Member Author

I committed 2dcf4b3 directly to the upstream by accident.

@StefH
Copy link
Collaborator

StefH commented Feb 2, 2020

Sorry, I forgot to tell you. I did update some code in your "PathUtils" branch.

I'll take a look a try to fix.

@NoahLerner
Copy link
Member Author

I'll take a look a try to fix.

Thank for having a look.

Sorry, I forgot to tell you. I did update some code in your "PathUtils" branch.

I saw, that's totally fine. Let's move this part of the discussion to that PR.

@StefH
Copy link
Collaborator

StefH commented Feb 2, 2020

@thewholuver94 --> I did remove all your commits from the master branch. It should be good to go.

NoahLerner added a commit to NoahLerner/WireMock.Net that referenced this pull request Feb 2, 2020
StefH pushed a commit that referenced this pull request Feb 5, 2020
* Fix new Delete with body missing from IWireMockAdminApi interface

* Admin Delete with mappings in body (#409)

* Add unit test for delete with body

* change order of checks for readability. looks nicer.

* Allow body in DELETE requests

* Fix unit tests according to DELETE supporting body

* Re-run CI

* Fix DELETE with body unit test

* Fix ElementAt index in mappings list

* Fix DELETE with body unit test

* Fix theory tag must be accompanied by some InlineData or Member

* Fix didn't use correct checking syntax

* Fix wrap entire unit test in if region
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants