Skip to content

Commit

Permalink
Merge pull request #55 from leaxoy/master
Browse files Browse the repository at this point in the history
Add rest method to Resource
  • Loading branch information
aturon authored Nov 24, 2018
2 parents 35dd9eb + e45f6a5 commit eba71f0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,24 @@ impl<Data> Resource<Data> {
pub fn delete<T: Endpoint<Data, U>, U>(&mut self, ep: T) {
self.method(http::Method::DELETE, ep)
}

/// Add an endpoint for `OPTIONS` requests
pub fn options<T: Endpoint<Data, U>, U>(&mut self, ep: T) {
self.method(http::Method::OPTIONS, ep)
}

/// Add an endpoint for `CONNECT` requests
pub fn connect<T: Endpoint<Data, U>, U>(&mut self, ep: T) {
self.method(http::Method::CONNECT, ep)
}

/// Add an endpoint for `PATCH` requests
pub fn patch<T: Endpoint<Data, U>, U>(&mut self, ep: T) {
self.method(http::Method::PATCH, ep)
}

/// Add an endpoint for `TRACE` requests
pub fn trace<T: Endpoint<Data, U>, U>(&mut self, ep: T) {
self.method(http::Method::TRACE, ep)
}
}

0 comments on commit eba71f0

Please sign in to comment.