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

Allow other methods than POST to be overridden #8

Open
gerhardj opened this issue Mar 31, 2017 · 5 comments
Open

Allow other methods than POST to be overridden #8

gerhardj opened this issue Mar 31, 2017 · 5 comments

Comments

@gerhardj
Copy link

Our customer wants to send a PATCH request to our API with an override header of DELETE.

I thought of adding another optional configuration option similar to the header and param:

  • override_all - allows all original methods to be overridden when an override param or header is set. Default: 0, Options: 1|0

When you accept this feature, we will hopefully get around to send a pull request.

@ap
Copy link
Collaborator

ap commented Mar 31, 2017

Our customer wants to send a PATCH request to our API with an override header of DELETE.

What’s the point…?

@gerhardj
Copy link
Author

Well, it's basically just the way, their enterprise provisioning system works.

Actually, I got it wrong in my initial explanation. It allows DELETE but doesn't understand PATCH. Now our API expects a PATCH or PUT request with a content which sets our entity to the terminated state. Because of limitations on their system, they just can send us a DELETE request for this usecase.

And I would say, DELETE is in this case semantically closer, to what they want to achieve than POST.

Anyway, our system had already supported that, through "Catalyst::ActionRole::HTTPMethods". But the functionality was dropped in favour of this Middleware. So we actually experienced a "regression" here and had to patch our software ourselves. So having this new option would actually bring the functionality closer to what Catalyst users have had before.

@ap
Copy link
Collaborator

ap commented Mar 31, 2017

Now our API expects a PATCH or PUT request with a content which sets our entity to the terminated state.

Hmm. But a DELETE doesn’t have a request body. So what happens if the client sends one with an override to turn it into a PATCH? Doesn’t your app need logic somewhere to inject the request body (at least in effect)?

@gerhardj
Copy link
Author

gerhardj commented Apr 4, 2017

DELETE can have a request body, it's just not usually done. [1]

@ap
Copy link
Collaborator

ap commented Apr 4, 2017

So the client sends a DELETE with a body…?

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

No branches or pull requests

2 participants