Commit Graph

24 Commits

Author SHA1 Message Date
Eric Dattore 0b2d3e80b1
Update to latest Rocket master (#91)
- Update all instances of `State<T>` to borrow and drop anonymous lifetime
- Remove examples showing returning a `Response` instead of a `Responder`
  since `Response` no longer implements `Responder`
2021-05-28 10:57:55 +08:00
thanadolps c0d7b36877
Update to latest master Rocket version (#89)
* Change to catch up with latest rocket master

- rocket::handler -> rocket::route
- request.get_param() -> request.param
- Change attach -> ignite and ignite -> build
- Update lifetime signature of FromRequest

* Remove unused import

* Remove colliding route in catch_all_options_routes()

In rocket 0.5 "/<catch_all_options_route..>" should match path "/" too hence the collision.

* Revert "Remove unused import"

This reverts commit 69db6d53

* add #[allow(unused_imports)] to log

* lock Rocket to specific commit

* apply rustfmt
2021-04-26 15:36:37 +08:00
Henning Holm fae7ccf9ce
Use async version from rocket's master branch (#81)
* Use hyper re-export from rocket_http

This way, the hyper version corresponding to the current rocket version
is used for the tests.

* Use async version from rocket's master branch
* switch rocket version to master branch
  (use release version once async is available)
* adapt code to incorporate changes from rocket and hyper
* Make Clippy happy again
* Make crate compile on Rust stable

Rocket meanwhile works on Rust stable, so there is no reason to be
limited to nightly.
* Fix GitHub CI build
* Use stable branch of Rust instead of broken minimum required nightly
  version.
* Disable fail-fast to reveal all problems at once.
* Remove deletion of rust-toolchain file as the file is no longer
  required/existing.

Co-authored-by: Maximilian Köstler <maximilian@koestler.hamburg>
2020-09-07 20:47:01 -06:00
Yong Wen Chua f00b1f9a38
Add more docs 2019-03-18 10:13:15 +08:00
Yong Wen Chua 6f56109d77
Support Regex in origins configuration (#62)
* Refactor Origin

* Fix tests

* Fix tests

* Add JSON deserialization test

* Support regex

* Fix wording

* Fix wording
2019-03-12 15:05:40 +08:00
Yong Wen Chua f9bffe77d6
Refactor Origins to better support additional use cases (#59)
* Specify an internal structure for Cors

* Use type alias

* Refactor Origin validation

* Separate out `Origin`

* Add tests
2019-03-12 09:58:51 +08:00
Yong Wen Chua c86bb44529
Create `CorsOptions` (#57)
* Create `CorsOptions`

- `Cors` will be, in the future, an "optimised" or "compiled" version of
`CorsOptions`
- For now, `Cors` simply clones `CorsOptions` and `Deref`s to
`CorsOptions`.

* Update examples

* Remove usage of `Self` struct constructors
2018-12-19 01:29:26 +01:00
Yong Wen Chua 13a3f7368e
Upgrade to Rust 2018 to fix Macro use and import issues (#52)
* Upgrade to Rust 2018 to fix Macro use and import issues

Fixes #51

* Cargo fmt
2018-11-21 12:17:40 +08:00
Yong Wen Chua b80c1939d4
Remove `macro_use` on `extern crate` (#47)
* Remove macro_use from examples

* Remove macro_use from log and rocket

* Remove macro_use for serde_derive

* Remove from examples

* Fix no-default features build failure
2018-10-31 10:59:01 +08:00
Yong Wen Chua 086f018bb9
cargo fix --edition 2018-10-31 10:31:16 +08:00
Yong Wen Chua 4dda14373a
cargo fmt 2018-10-31 10:30:10 +08:00
Eric Dattore 0b73773692 Update library to 0.4 and support Rocket 0.4 (#46)
* Update Cargo.toml for Rocket `master`

* Prepare library for Rocket 0.4

TODO: check line 62 in `fairing.rs` to find better way than unwrapping

* Bump minimum nightly for Rocket 0.4
2018-10-31 10:25:10 +08:00
Yong Wen Chua 7954d9d078
Cargo fmt (#42) 2018-07-18 13:26:33 +08:00
Yong Wen Chua 4db0969584
Bump Rocket, Rust version and remove impl trait flag (#40)
* Bump Rocket, Rust version and remove impl trait flag

* Seems to build now

* Ignore Rocket documentation errors

* Update travis script

* Increase nightly version by a day

* Bump again
2018-07-18 13:07:31 +08:00
Yong Wen Chua ec04e27a89
Configure the rank of the injected Fairing error handling route (#36)
* Add option to change the rank of the injected Fairing error handling route

* Document the route
2018-02-14 14:21:50 +08:00
Yong Wen Chua 39eb59e466 Address ICE related to impl trait
Original bug: https://github.com/rust-lang/rust/issues/43380

Fixes #33
2018-02-14 13:37:48 +08:00
Yong Wen Chua ff1deabf55 Rustfmt fix
- Bump to 0.2.2
 - Add Travis cargo cache
2018-02-14 13:22:43 +08:00
Yong Wen Chua 9782a47456 Add "mix" mode example (#26)
* Add "mix" mode example

* Fix typo
2017-09-05 14:59:51 +08:00
Yong Wen Chua 715913a6b3 Gate serde behind a feature flag (#25)
* Gate serde behind a feature flag

Fixes #16

* Fix travis build configuration
2017-09-05 14:11:28 +08:00
Yong Wen Chua 36ec852a78 Add catch-all OPTIONS route and update examples/tests (#24) 2017-07-24 15:45:53 +08:00
Yong Wen Chua 92d7775b93 "Truly manual" API (#22)
* Experimental "truly manual" API

* Add API for general usage

* Add documentation and example

Change Fn to FnOnce to allow for moving and consuming
2017-07-24 13:11:10 +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 8fc8fef3eb Add documentation (#15)
* Add documentation for Fairing

* Add Guard example and documentation
2017-07-18 18:22:20 +08:00