Commit Graph

19 Commits

Author SHA1 Message Date
Yong Wen Chua 9de966bb29 Add documentation and example
Change Fn to FnOnce to allow for moving and consuming
2017-07-24 11:31:49 +08:00
Yong Wen Chua 23cf7df415 Add API for general usage 2017-07-24 10:35:37 +08:00
Yong Wen Chua 0163ff6a26 Fix bug where Access-Control-Allow-Origin included a trailing `/`
Which broke all browsers
2017-07-19 16:26:44 +08:00
Yong Wen Chua 0a94dfe22a Add Convenience typedefs and functions (#19)
* Add JSON documentation and convenience AllowedOrigin

* Add `AllowedHeaders`

* Add AllowedHeaders

* Fix tests
2017-07-19 12:25:56 +08:00
Yong Wen Chua fcd83e8fb5 Fix an issue where Fairing on_response will inject CORS headers into failed CORS requests 2017-07-19 09:52:30 +08:00
Yong Wen Chua 35e9665628 Add remaining missing unit tests (#12) 2017-07-18 13:11:30 +08:00
Yong Wen Chua 808329c1c4 Remove benchmark 2017-07-17 23:11:13 +08:00
Yong Wen Chua 41f5ac11d8 Refactor to separate out validation from response building step 1 2017-07-17 23:11:12 +08:00
Yong Wen Chua 191868573d Add bench 2017-07-17 18:06:06 +08:00
Yong Wen Chua 56de116595 Add serde pass between fairings 2017-07-17 18:06:00 +08:00
Yong Wen Chua eb98ae33bc Implement Serde (De)serialization for `Cors` struct (#7)
* Add serde support for Method

* "Turn on" serde

* Add Serde support for UniCase

* Fix merge error

* Add default tests
2017-07-17 16:22:45 +08:00
Yong Wen Chua a349b8772d Add tests to ensure that routes are not executed on failure 2017-07-17 14:41:08 +08:00
Yong Wen Chua a90556c470 Implement CORS Fairing (#9)
* Add validate to Cors

* Skeleton

* Refactor to allow for fairings to be even built

* Errors are not handled properly

* Response no longer validates

* Ad-hoc response now use response guards

* Seems like lifetime proliferation

* Wrap Response in a Guard with some dummy lifetime

* Fairing implementation
2017-07-17 14:28:54 +08:00
Yong Wen Chua 6f1a24e12d Move some code to headers module 2017-07-15 11:18:37 +08:00
Yong Wen Chua d23c935a4a Rename Options to Cors 2017-07-15 10:54:26 +08:00
Yong Wen Chua 7dbc22b523 Delay CORS checks and response until `Responder::respond_to` is invoked (#6)
* Delay checking of CORS to just before responding

* Lifetime issues

* Use State::inner()

* Fix lifetime issues

* Bump Rocket

* Document 'static limitation

And link to https://github.com/SergioBenitez/Rocket/pull/345

* Remove extraneous comments
2017-07-15 01:38:13 +08:00
Yong Wen Chua f1391281cd Response unit tests 2017-07-14 15:35:44 +08:00
Yong Wen Chua ca096ceb28 Extract headers integration tests 2017-07-14 13:54:34 +08:00
Yong Wen Chua 830b14afed Move integration tests 2017-07-14 12:26:47 +08:00