Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Custom HTTP method #29

Merged
merged 1 commit into from
Jun 24, 2015
Merged

Conversation

weierophinney
Copy link
Member

It will be nice feature to define own custom http method. Now it's not possible to override or add new one. I can provide PR, but I want to know what are you think about it.

@weierophinney
Copy link
Member

Please do; RFC 7230 allows for custom methods, but I went a rather strict route.

Ideally, we should allow any sequence RFC 7230 allows, which is a token; tokens are one or more of the following characters only:

"!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA

This could be accounted for in the withMethod() method, instead of using the internal array of HTTP methods.

@gianarb
Copy link
Contributor

gianarb commented May 27, 2015

Is HTTP Method Overrides a good solution to use custom method without other code?
I don't know :)

@weierophinney
Copy link
Member

@gianarb Not sure I understand your comment… could you clarify?

@gianarb
Copy link
Contributor

gianarb commented May 27, 2015

@weierophinney sorry it's a bad comment but I have seen a lot of implementation that use X-Method-Override to specify a custom method if it is not supports from original implementation.

For example.. If you server not support PATCH you can send a POST with X-Method-Override: PATCH.. But maybe this is another use case..

@weierophinney
Copy link
Member

@gianarb that's another use case; that would be something for the ServerRequest to handle and/or to issue with a client request.

@weierophinney weierophinney added this to the 1.1.0 milestone Jun 24, 2015
@weierophinney weierophinney self-assigned this Jun 24, 2015
RFC 7230 allows request methods that consist of one or more tokens,
which include the following characters:

```
!#$%&\'*+.^_`|~-
```

and any ASCII alphabetical characters or digits. This patch changes
`validateMethod()` to use a regex that includes those characters,
instead of comparing against a known list of HTTP methods.
'TRACE',
];

/**
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed the above, as it's no longer necessary; validation is not against this list.

@weierophinney weierophinney merged commit 2dce8a6 into zendframework:develop Jun 24, 2015
weierophinney added a commit that referenced this pull request Jun 24, 2015
weierophinney added a commit that referenced this pull request Jun 24, 2015
@weierophinney weierophinney deleted the feature/29 branch June 24, 2015 15:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants